ylabel position with pgfplots

Quoting the manual, section 4.8.3 Labels:

Upgrade notice: Since version 1.3, label placement can respect the size of adjacent tick labels. Use \pgfplotsset{compat=1.3} (or newer) in the preamble to activate this feature.

In the following MWE, uncomment the pgfplotsset line to see the difference.

\documentclass{article}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.5}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ylabel=Something,scaled ticks=base 10:-11]
\addplot coordinates {(0,0) (1,1000) (2,10000)};
\end{axis}
\end{tikzpicture}
\end{document}

On the left, with compat=1.5, on the right without:

enter image description here enter image description here

One could use compat=newest to always use the newest version, but this could lead to issues with backwards compatibility, as future versions may behave differently. (See comment from Christian Feuersänger, author of pgfplots, below.)


I am answering myself here, at the end I end up using the following style for the ylabel, which basically forces the label to appear at the coordinates that you set. I guess that this will work also with versions older than 1.3 of pgfplots.

  y label style={at={(-0.1,0.5)}},

enter image description here

Tags:

Pgfplots