# pgfplots exponent in ylabel instead of yticklabel

I know there are already a lot of questions answered about the exponents of the ticklabels and how to get rid of them, but in my extensive search I was not able to find an answer to my specific question.
Take the following example:

\documentclass[crop,10pt]{standalone}
\usepackage[english]{babel}
\usepackage{pgfplots}

\usepackage[space-before-unit,range-units = repeat]{siunitx}

\begin{document}%
\setlength{\linewidth}{246pt}%

\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
ytick pos = left,
xtick pos = left,
enlargelimits=false,
clip=false,
axis on top,
tick align = outside,
yticklabel style={%
/pgf/number format/fixed,
/pgf/number format/precision=1,
/pgf/number format/fixed zerofill
},
xlabel={length (\si{\meter})},
ylabel={length (\si{\meter})},
]
coordinates
{(1,0.0005) (2,0.001)   (3,0.0015)};
\end{axis}
\end{tikzpicture}
\end{document}


The graph and the ticklabels look the way I want them to. The only thing I want to do now, is to get rid of the " *10^{-3} " above the y axis and (manualy) change the ylabel to milimeters. When I use the scaled ticks=false option, this will change the ticklabels again and I would have to display them as 0.0005, 0.0010 and 0.0015 instead of 0.5, 1.0 and 1.5 which looks ugly. So the question is: Is there a way to get rid of the exponent (not displaying it) without the ticklabels getting changed? (Of course any other solution would also be appreciated)
John

-

This is exactly what the units library is for.

It allows you to specify the SI base unit for your axis (in this case y unit=m) and if you allow the library to change the base for the numbers (by setting change y base=true) you can specify an SI prefix that will be applied to the label and the numbers (by setting y SI prefix=milli).

The format of the unit in the label can be controlled using unit markings=parenthesis, for instance:

\documentclass[border=5mm]{standalone}
\usepackage[english]{babel}
\usepackage{pgfplots}
\usepgfplotslibrary{units}

\usepackage[space-before-unit,range-units = repeat]{siunitx}

\begin{document}%
\setlength{\linewidth}{246pt}%

\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
ytick pos = left,
xtick pos = left,
enlargelimits=false,
clip=false,
axis on top,
tick align = outside,
unit markings=parenthesis,
y unit=m, change y base=true,  y SI prefix=milli,
yticklabel style={%
/pgf/number format/fixed,
/pgf/number format/precision=1,
/pgf/number format/fixed zerofill
},
xlabel={length (\si{\meter})},
ylabel={length},
]
coordinates
{(1,0.0005) (2,0.001)   (3,0.0015)};
\end{axis}
\end{tikzpicture}
\end{document}

-
Cool, thanks! This really works great! –  Janek Oct 1 '12 at 8:44

You can use ytick scale label code/.code={}:

\documentclass[crop,10pt]{standalone}
\usepackage[english]{babel}
\usepackage{pgfplots}

\usepackage[space-before-unit,range-units = repeat]{siunitx}

\begin{document}%
\setlength{\linewidth}{246pt}%

\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
ytick pos = left,
xtick pos = left,
enlargelimits=false,
clip=false,
axis on top,
tick align = outside,
yticklabel style={%
/pgf/number format/fixed,
/pgf/number format/precision=1,
/pgf/number format/fixed zerofill
},
xlabel={length (\si{\meter})},
ylabel={length (\si{\meter})},
ytick scale label code/.code={}
]
coordinates
{(1,0.0005) (2,0.001)   (3,0.0015)};
\end{axis}
\end{tikzpicture}
\end{document}


-
Thank you! That was exactly the option I was looking for. It's alway difficoult to figure out what to search for in the manual when english is not your first language. Thanks! (Apperently I have to wait 5 more minutes to accept the answer...) –  Janek Sep 28 '12 at 14:36