TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
Probably the option ylabel near ticks for the axis environment will correct the position of the y-axis label. – Thorsten Donig Mar 3 '12 at 17:18
up vote 15 down vote accepted

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

share|improve this answer
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 Mar 3 '12 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 Mar 3 '12 at 17:38
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. – Christian Feuersänger Mar 3 '12 at 18:15
@ChristianFeuersänger Thanks for the note! – Torbjørn T. Mar 3 '12 at 18:20

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

share|improve this answer
You could rather have set compat=1.3 inside the axis environment of the tikzpicture :) – Eshwar Jun 3 '12 at 21:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.