Take the 2-minute tour ×

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).




  \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)


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.


share|improve this question
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
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


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


