# Adjustable absolute axis labels in pgfplots

How can I use absolutely placed y labels, but still adjust the absolute placement? In the below example, I want to be able to get the two plots to align exactly, including the y labels.

ylabel absolute,


to the list of arguments of

\begin{axis[


I cannot use

ylabel shift = 0.1cm,


in the same argument list. If I skip ylabel absolute, I can use ylabel shift, but then I have to use different values for yshift (and it is not obvious exactly which values) to get equal spacing. Ideally, I would like to first fix the position of the y label (as ylabel absolute does) and then shift it (as ylabel shift does). How can that be done?

MWE:

\documentclass{article}
\usepackage[tightpage,active]{preview}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}

\begin{document}
\begin{preview}
\begin{tikzpicture}
\begin{axis}[
height=6cm,
width=9cm,
xlabel=$x$,
ylabel=$y$]
plot coordinates {
(0,3)
(2,4)
(3,1)
};

plot coordinates {
(0,0)
(1,2)
(2,1)
(3,0)
};
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[
height=6cm,
width=9cm,
xlabel=$x$,
ylabel=$y$]
plot coordinates {
(0,3)
(2,4)
(3,1)
};

plot coordinates {
(0,-10)
(1,2)
(2,1)
(3,1)
};
\end{axis}
\end{tikzpicture}
\end{preview}
\end{document}


-
You can use ylabel absolute, ylabel style={yshift=1cm} to shift the labels. Is that what you mean? – Jake Mar 7 '13 at 16:45
Yes, that was what I wanted to do. Is ylabel shift=1cm an old command, and ylabel style={yshift=1cm} the one to replace it? – hjb981 Mar 7 '13 at 17:18
ylabel shift can result in a different direction for the shift compared to yshift. Clearly, yshift simply shifts upward or downward, but ylabel shift shifts along "the outer normal vector". Try it for a 3D axis to see the difference. – Christian Feuersänger Mar 8 '13 at 19:14
@Jake Please write your comment here up as an answer – Joseph Wright Aug 10 '13 at 6:46
Christian Feuersänger, thank you for your comment, I saw it just now. @Jake If you make your comment an answer, I will make it an accepted answer. – hjb981 Aug 14 '13 at 17:54

You can use ylabel absolute, ylabel style={yshift=1cm} to shift the labels.