# Pgfplots for every group plot

Similar to this question I want to align my y labels of groupplots. The style

ylabel absolute, y label/.append style={yshift=0em},


does the trick, and thus I want to apply this to every group plot. However, I don't really understand the settings category thing that's going on in tikz/pgfplots. I've tried many variations of the code below, which all compiled fine, but had no effect. Could someone point out how I can adress each group plot and append the above line to the style? *And maybe point out how to do this in general (where to find the subcategories etc)?

Basically, what I try to achieve is a way to modify the style of each group (groupplot?) and append the above ylabel absolute positioning. So something like every axis/ylabel, but for groups. (The former doesn't work, since it misplaces the ylabel of 3D plots.)

Minimal not-working example:

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots} % needs to be loaded exactly like this
\pgfplotsset{ /pgfplots/group/.append style = {
ylabel absolute, y label/.append style={yshift=0em},
}
}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={
group name=my plots,
group size=1 by 2,
xlabels at=edge bottom,
ylabels at=edge left
},height=4cm, width=4cm]
\nextgroupplot[ylabel={foo},]
\nextgroupplot[ylabel={bar},]
\end{groupplot}
\end{tikzpicture}
\end{document}

• It would be really nice if you added a complete example as well, so that we don't have to set up everything ourselves to test. – Torbjørn T. May 14 '16 at 9:02
• When adding a \documentclass and document environment your code produced aligned ylabels regardless of whether those styles are included or not. Do you have a compat setting in your code? – Torbjørn T. May 14 '16 at 10:08

Looking at the code of the groupplots library, I see that the style /pgfplots/group/every plot is added to each \nextgroupplot. So to only affect axes in groupplots environments, append to that style, e.g.

\pgfplotsset{/pgfplots/group/every plot/.append style = {
ylabel absolute, y label/.append style={yshift=0em},
}
}


\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\usepgfplotslibrary{groupplots}
\pgfplotsset{/pgfplots/group/every plot/.append style = {
ylabel absolute, y label/.append style={yshift=0em},
}
}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={
group name=my plots,
group size=1 by 2,
xlabels at=edge bottom,
ylabels at=edge left
},height=4cm, width=4cm]
\nextgroupplot[ylabel={foo}]
\nextgroupplot[ylabel={bar}]
\end{groupplot}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[ylabel=abc]

• @mike Well, I took the complicated route, and looked at the code of the groupplots library, and tried to find where a new axis was added to the group. But I see that it is mentioned in the manual as well, where it says that it is equivalent to adding options to the groupplot environment. – Torbjørn T. May 15 '16 at 8:20