[Tex/LaTex] Change axis number format for external tikz file

formattingpgfplotstikz-pgf

I'm using \input{filename.tikz} to include .tikz graphs created by matlab2tikz in my LaTeX document. As shown in a comment on this question it is possible to change the plot marker size when the document is inputted, without altering the original .tikz file.

Now I'm looking for a way to change the axis number formatting in the same fashion.
I have numbers on the y-axis that are of the form 5 x 10^-2 where I want them just to be 0.05.

I understand from this answer that this has more to do with pgfplot than with tikz, but I'm not sure how I would use the command given in the answer right before my \input statement.

Best Answer

The keys given in the axis options can also be set outside the axis environment by using

\pgfplotsset{
    every x tick label/.append style  =
        { 
          /pgf/number format/.cd,
           precision = 0, 
           fixed
        }
}

or, equivalently

\pgfkeys{
    /pgfplots/every x tick label/.append style  =
        { 
          /pgf/number format/.cd,
           precision = 0, 
           fixed
        }
}

For the example given in the answer this would become:

\pgfkeys{
        /pgfplots/every y tick label/.append style  =
            { 
              /pgf/number format/.cd,
               precision = 2, 
               fixed
            }
    }