1

The alignment of the various legend entries for a number of groupplots on the right side (´legend pos = outer north east´) happens quasi by default.

Unfortunately, there is no key to place the legend to the left side (it's a bit unusual esp cos there is the axis label -- but in a 'twoside'-document it seems to me to make sense to change the side for odd resp. even-sides).

How can I align the legends for a multiple groupplots on the left side?

mini working example:

\documentclass[varwidth]{standalone}
\usepackage{pgfplots,tikz}
\pgfplotsset{
compat=1.12
}
\usetikzlibrary{patterns}
\usetikzlibrary{pgfplots.groupplots}

\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={
    group name=my plots,
    group size=1 by 3,%10
    },
        legend cell align=left,
    legend style={cells={align=left}},
    legend style={draw=none},
    legend pos = outer north east,
   ]  
\nextgroupplot
 \addplot {rnd};
\addlegendentry{tes};

\nextgroupplot
 \addplot {rnd};
\addlegendentry{test 2012};

\nextgroupplot
 \addplot {rnd};
\addlegendentry{test 20134214};
\end{groupplot}
\end{tikzpicture}

\begin{tikzpicture}
\begin{groupplot}[
group style={
    group name=my plots,
    group size=1 by 3
    },
        legend cell align=left,
    legend style={cells={align=left}},
    legend style={draw=none},
    legend style={at={(-0.182,1.0)},anchor=north east},
   ]  
\nextgroupplot
 \addplot {rnd};
\addlegendentry{tes};

\nextgroupplot
 \addplot {rnd};
\addlegendentry{test 2012};

\nextgroupplot
 \addplot {rnd};
\addlegendentry{test 20134214};
\end{groupplot}
\end{tikzpicture}


\end{document} 

mini example

1 Answer 1

1

Just set the anchor of the legend to something on the left side I suppose, e.g. north west. You need to move them left a bit more as then of course, for example modify your legend style to

 legend style={at={(-0.6,1.0)},anchor=north west},

which gives

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .