Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
2  
Using \foreach \x in {5,10,...,80}... is ok for you? –  Harish Kumar Dec 24 '12 at 0:30
1  
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Benedikt Bauer Dec 24 '12 at 0:32
add comment

1 Answer

Simply use

\foreach \x in {5,10,...,80} %% <-- change here
             \draw (\x,1pt) -- (\x,-3pt) 
                node[anchor=north] {\footnotesize\x}; 

Or better option will be pgfplots.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.