I'm trying to display the tick labels of the y axis of just this graph within my document formatting to two decimal places. I've tried the following code but it seems that it doesn't like the way I'm trying to change the y tick label style, what have I done wrong?



\begin{axis}[minor tick num=1,xmin=0,xmax=6,ymin=100000, ytick={100000,125000,150000,175000,200000,225000,250000,275000,300000}, y tick label style={/pgf/number format/.cd,fixed,fixed zerofill,precision=2},
xlabel={X}, ylabel={Y},
\addplot [black,thick] table{\Pone};


And just for example, Pone.dat is:

1 100000
2 150000
3 200000
4 210000
5 220000
6 230000
  • Sorry, I've added the definition of \Pone and an example of the .dat file it is called from.
    – Andy
    Mar 4, 2012 at 11:39

1 Answer 1


Some styles for the tick label placement and the inner sep are set after the user specified styles. If you use /pgf/number format/.cd in your style, this change of directory remains active, and TikZ complains about not finding keys like /pgf/number format/inner sep, which reside in the /tikz directory. You need to .cd back into the /tikz directory (or not use .cd, but use the full /pgf/number format path for all the options).


    minor tick num=1,
    ytick={100000, 125000, 150000, 175000, 200000, 225000, 250000, 275000, 300000}, 
    xlabel={X}, ylabel={Y},
    y tick label style={
        /pgf/number format/.cd,
        fixed zerofill,
\addplot [black,thick] table [row sep=crcr]{
0 150000\\
2 200000\\

  • Thanks Jake, that has worked great in my example. Out of interest is that the 'optimum' way for changing number of decimal places displayed? I found that half code example for changing the decimal places elsewhere, so it's not really obvious to me what the .cd and fixed do, it was only the precision=2 that seemed to suit my needs.
    – Andy
    Mar 4, 2012 at 12:22
  • Is there any way to do this more "dynamically"? I.e., I have a plot that goes fro 0 to 0.2 on the y axis, and tikz set labels 0, 5*10-2, 0.1, 0.15 , 0.2 which is not very nice at all. But if I "mass produce" plots, some of them will be in y = [0 3e5], and some will be the aforementioned example. Any way to make sure Tikz is consistent on THE SAME Y AXIS (not consistent over multiple plots)?
    – Clausen
    Jun 30, 2014 at 23:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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