Very first time using LuaLatex and Tikz/PGF to generate plot of a function (I use it for directed graphs a lot, but not functions). Following MWE works pretty well, except that I want to prevent writing the 0 label on the x-axis at the origin. If you run this, you'll see that the x-axis label 0 overlays the vertical y-axis. Not what I want.
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
% GNUPLOT required
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[x=0.1cm,y=1.2cm]
% set up maximum and minimum x- and y-coordinates
\def\xmin{-0.5}
\def\xmax{81.8}
\def\ymin{-1.8}
\def\ymax{2.5}
% draw and label axes
\draw[->] (\xmin,0) -- (\xmax,0) node[right] {$N$};
\draw[->] (0,\ymin) -- (0,\ymax) node[above] {$dN$};
% tick marks and tick labels on axes
\foreach \x in {0,5,...,80}
\draw (\x,1pt) -- (\x,-3pt)
node[anchor=north] {\footnotesize\x};
\foreach \y in {-1.5,-1.0,...,2}
\draw (1pt,\y) -- (-3pt,\y)
node[anchor=east] {\footnotesize\y};
% now plot the function
\draw[color=blue,thick, smooth,domain=0:80.1] plot[id=logistic] function{0.1*x*(1- x/70)} node[right]{$\frac{dN}{dt}=rN\left(1-\frac{N}{K}\right)$};
\end{tikzpicture}
\end{document}
I tried using \phantom
\foreach \x in {\phantom,5,...,80}
\draw (\x,1pt) -- (\x,-3pt)
node[anchor=north] {\footnotesize\x};
but that wouldn't compile.
The only thing I've found that works is to insert a period (dot), instead of the zero:
\foreach \x in {.,5,...,80}
\draw (\x,1pt) -- (\x,-3pt)
node[anchor=north] {\footnotesize\x};
This works, more or less, but seems 'clunky' (inelegant). I'm sure there is a better way – suggestions?
Best Answer
Simply use
Or better option will be
pgfplots
.