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.

I'm creating a several graphs with pgfplots. The problem I'm coming across is that some graphs do not have a value for the last coordinate as per the example below (and I want to keep the ticks on the x axis consistent).

\documentclass{standalone}

\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[xtick={1,2,5,10,20,50,100},xticklabels={1,2,5,10,20,50,100},unbounded coords=jump,xminorticks=false,yminorticks=false]
    \addplot[smooth] coordinates {
      (1.0000000000, 1.3562500000)
      (2.0000000000, 1.2825000000)
      (5.0000000000, NaN)
      (10.0000000000, 4.2087500000)
      (20.0000000000, 10.7962500000)
      (50.0000000000, 91.7450000000)
      (100.0000000000, NaN)
    };
  \end{axis}
\end{tikzpicture}


\end{document}

which produces:

enter image description here

Is there a way to force the x axis to include the tick and label for 100? The 'unbounded coords=jump' option does not help since there are no more lines to draw.

Thanks

share|improve this question
1  
You can add something like xmax=102 to the axis options. –  Gonzalo Medina Aug 28 '12 at 17:20
    
That works for me. Do you want to add that as an answer so I can accept it? –  nunolopes Aug 28 '12 at 17:33
    
I've turned my comment into an answer, but perhaps you would like to wait a little longer before accepting it to see if someone else gives a better solution. –  Gonzalo Medina Aug 28 '12 at 17:41
1  
You can also check the enlarge limits options in the manual. –  percusse Aug 28 '12 at 17:50
    
Since you say you want the axes to be consistent between different plots, I would suggest going with Gonzalo's suggestion (and also supplying xmin=0 explicitly). –  Jake Aug 28 '12 at 18:27
show 1 more comment

1 Answer

up vote 2 down vote accepted

You can add something like xmax=102 to the axis options.

share|improve this answer
    
I ended up using 'xmax=100,enlargelimits=true'. Works fine. Thanks. –  nunolopes Aug 28 '12 at 18:30
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.