I'd like to add zero lines to a groupplot by defining them once in the groupplot environment.
I of course based this on the clues and replies I found on here & in the manual, but so far I couldn't get it to work.
MWE
\documentclass[
a4paper
]{scrartcl}
\usepackage{
lmodern,
amsmath,
tikz,
pgfplots,
pgfplotstable
}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{center}
\begin{tikzpicture}[font=\small]
\begin{groupplot}[
group style={
group size=1 by 2,
horizontal sep=0cm,
vertical sep=1.5cm
},
%
execute at begin axis/.append code={ %<-this line works for the normal 'axis'
%the following 3 do not produce an error but do not work either:
%execute at every axis/.append code={
%execute at every plot/.append code={
%execute at begin plot/.append code={
\draw[thin] (axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) -- (axis cs:\pgfkeysvalueof{/pgfplots/xmax},0);
\draw[thin] (axis cs:0,\pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,\pgfkeysvalueof{/pgfplots/ymax});
},
%
height=6cm,
width=14cm,
%
scaled x ticks=true,
scaled y ticks=false,
%
xlabel={The label for the x-axis},
ylabel={Some y-values},
]
\nextgroupplot
\addplot {rand};
%
\nextgroupplot
\addplot {rand};
\end{groupplot}
\end{tikzpicture}
\end{center}
\end{document}


execute at every axis-bit isn't necessary at this point. However this code only makes sense with the necessary bit for getting a symmetric share on the y-axis which defeats the purpose of the easily automated solution. Besides, it may end up looking really weird, depending on the data (which is does in my real document). Thank you very much for your effort. – henry Jul 20 '14 at 13:53