I have the following code


  6.3e-05 0.8767984145412976 0.6
  0.000125 12.85965577546382 9.970000000000001
  0.00025 16.95140970189756 13.76
  0.0005 14.61328253838453 12.13
  0.001 21.24630316052836 17.76
  0.002 33.45255040918443 27.81
  0.004 0 17.97
  0.0056 0 0
  0.008 0 0
  0.0112 0 0
  0.016 0 0
  0.0224 0 0
  0.0315 0 0


  /pgf/bar width=5pt,
  bar cycle list,
  scale only axis,
  ymin=0, ymax=100, 
  tick label style={font=\scriptsize},
  x tick label style={/pgf/number format/sci},
  xticklabels from table={\datatable}{0}
  \addplot table[x expr=\coordindex,y=1]{\datatable};
  \addplot table[x expr=\coordindex,y=2]{\datatable}; 

which gives me this plot

enter image description here

Now instead of the fixed format for the xticklabels I want the scientific format and want an xtick on every delivered coordinate. How do I achieve this? I tried it with x tick label style={/pgf/number format/sci} but that did not help.


To have every xtick I had to use the option xtick=data.

  • So you are trying to avoid the overlap?
    – percusse
    Commented Jun 30, 2013 at 10:07
  • No that's not the problem, I can use rotate=90. I just want the label in the scientific format like 1.25e-4 and so on.
    – Reza
    Commented Jun 30, 2013 at 10:12
  • 2
    The key xticklabels from table has been introduces for symbolic data, i.e. it does not apply the number printer at all. Might be a feature request. Do you need xticklabels from table? Commented Jun 30, 2013 at 10:37
  • 1
    Yes that would be great to have such a feature
    – Reza
    Commented Jun 30, 2013 at 10:52
  • @ChristianFeuersänger I would benefit from this feature too.
    – M. Toya
    Commented Jul 8, 2013 at 9:28

1 Answer 1


1 xtick=data means the x-axis from data.

2 But xticklabels from table means the x-axis format from data.

That is, if you want the legend read from \datatable, use first method.

The example from PGFplots Official website shows the difference in two methods. The example 323(or in Manual version 1.8 page 302)

    xmin=-4.7124, xmax=4.7124,
    xticklabels={$-\frac{3}{2} \pi$,$-\pi/2$,$\pi/2$,$\frac{3}{2} \pi$},

Note that xtick refers to values, and xticklabels refers to format.

So if I change your code,xticklabels from table={\datatable}{0} to xtick=data, it's done. But it is ugly then.

  • 1
    The idea is that number printing is bypassed when labels are loaded from table. For example, if I had an extra column just for the labels then your solution wouldn't work since xticks and the labels would be different
    – percusse
    Commented Aug 29, 2013 at 10:48
  • Could you explain more about "extra column just for the labels"? I don't get it.
    – Tawei
    Commented Aug 30, 2013 at 4:02
  • Add another column to the table starting from 17 to 30 and I want to use it as labels using scientific notation(can be more complicated). Then xtick trick doesn't work. That's why it's a feature request given in the comments.
    – percusse
    Commented Aug 30, 2013 at 8:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .