[Tex/LaTex] Align ylabels of grouped plots at a common line

groupplotspgfplots

I use the groupplots library of pgfplots to stack several plots above each other. The y tick label of the two plots have different width as the y axes of the plots are in different scales. As long as I don't set \pgfplotsset{compat=1.6}, pgfplots does not consider the y tick label's width at all and prints the ylabel right across the tick labels. When I activate the compat=1.6 option, the size of the tick labels is considered when placing the label, but in this case (cf. MWE below), the ylabels are placed relative to the tick labels of the concerning plot and therefore the labels of the two plots have different distance to the border of the whole plot group.

Is there a simple command to align the ylabels at a common vertical line instead of aligning each of them relative to its respective plot?

\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.6}

\begin{document}
\begin{tikzpicture}
\begin{groupplot}
[group style={group size = 1 by 2}]
\nextgroupplot[ylabel = Text]
\addplot coordinates {(0,0) (1,0.1)};
\nextgroupplot[ylabel=Text]
\addplot coordinates {(0,0) (1,2)};
\end{groupplot}
\end{tikzpicture}
\end{document}

Example output

Best Answer

You can redefine the every axis y label style by increasing the xshift value as required.

\documentclass{standalone} 
\usepackage{pgfplots} 
\usepgfplotslibrary{groupplots} 
\pgfplotsset{compat=1.6,
             ylabsh/.style={every axis y label/.style={at={(0,0.5)}, xshift=#1, rotate=90}}}  

\begin{document}  
\begin{tikzpicture}  
\begin{groupplot}  
[group style={group size = 1 by 2}, ylabsh=-5em]  
\nextgroupplot[ylabel = Text]  
\addplot coordinates {(0,0) (1,0.1)};  
\nextgroupplot[ylabel=Text]  
\addplot coordinates {(0,0) (1,2)};  
\end{groupplot}  
\end{tikzpicture}  
\end{document}

enter image description here

Now it doesn't matter the running version.