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.


enter image description here

  • 1
    Probably the option ylabel near ticks for the axis environment will correct the position of the y-axis label. Commented Mar 3, 2012 at 17:18

2 Answers 2


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.

\begin{axis}[ylabel=Something,scaled ticks=base 10:-11]
\addplot coordinates {(0,0) (1,1000) (2,10000)};

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

  • Thanks for your answer, however for some mysterious reason I cannot use \pgfplotsset{compat=newest}, probably I have an old version of the package that doesn't support this (and I cannot install new versions in this computer). Anyway, I found another solution, see my answer below. Thanks!
    – Dan
    Commented Mar 3, 2012 at 17:16
  • @Dan: In the question you say that you're using 1.5.1, which is the current version. \pgfplotsset{compat=newest} is definitely available. Please post a minimal working example in the question, and we can attempt to diagnose a conflict.
    – qubyte
    Commented Mar 3, 2012 at 17:38
  • 4
    Good answer. Note, however, that the usage of compat=newest has potential backwards compatibility impact: future versions might change behavior in way that you did not anticipate. It is generally better to write compat=1.5. Commented Mar 3, 2012 at 18:15

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

  • 1
    You could rather have set compat=1.3 inside the axis environment of the tikzpicture :)
    – gontadu
    Commented Jun 3, 2012 at 21:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .