[Tex/LaTex] pgfplot with constant decimal places on ticks

pgfplots

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?

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\pgfplotstableread{Pone.dat}{\Pone}
\begin{center}
\begin{tikzpicture}[scale=0.9]
\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};
\end{axis}
\end{tikzpicture}
\end{center}

\end{document}

And just for example, Pone.dat is:

1 100000
2 150000
3 200000
4 210000
5 220000
6 230000

Best Answer

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

\documentclass[]{article}
\usepackage{pgfplots}
\begin{document}

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

\end{document}