pgfplots, units and stale labels in groupplots

Today, a colleague of mine came up with this problem
Layout issue
Between the two groupplots, there is a additional label [K] which he liked to get rid of. The relevant source part was

\begin{groupplot}[
y unit=K
]
\nextgroupplot
\addplot coordinates { % snip
};
\nextgroupplot
\addplot coordinates { % snip
};
\end{groupplot}

The command that adds the stale label is defined for the groupplot environment and not only for one of the subplots. Hence, it will be shown for all subplots. The key issue here is the insight, that all \nextgroupplot commands are just like an axis environment. Thus, you can define the options for a single subplot as well (this holds true for all options, not only for this example)

\nextgroupplot[y unit=K]

If you want to disable the labeling for a minority of the subplots, it may be easier to reset the corresponding option

\nextgroupplot[y unit=]

In both cases, you will get the correct graphics
Fixed layout issue

You may also like...

Leave a Reply

Your email address will not be published.