pgfplots – Adjusting ylabel Position in pgfplots

pgfplots

I am using pgfplots to plot some data, but I am having problem you see in the image below. Basically, the ylabel overlaps with the axis numbering. I have googled a LOT but couldn't find any solution. Some people say that with versions >1.2 this should be automatically fixed, but even with 1.5.1 this is still happening to me…

Is there anyway to specify the location of the ylabel? Obviously I would like it to be a bit more to the left, so it does not overlap with the numbers.

Thanks!

enter image description here

Best Answer

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

Related Question