I'm using the legend-only solution from Using a pgfplots-style legend in a plain-old tikzpicture
How can I get a style for a single row? I'm trying to have row sep = 5pt for example for all rows, but between the second and third row have a different value. I've tried
legend style={row sep = 5pt,
/tikz/row 2/.style={row sep = 10pt}
}
This compiles fine and adds a 5pt separation to all rows, but it doesn't change the separation after the second row.
Thanks!
EDIT
Here's a MWE. I've simple copied the answer in the link and added the code above:
\documentclass{article}
\usepackage{pgfplots}
% argument #1: any options
\newenvironment{customlegend}[1][]{%
\begingroup
% inits/clears the lists (which might be populated from previous
% axes):
\csname pgfplots@init@cleared@structures\endcsname
\pgfplotsset{#1}%
}{%
% draws the legend:
\csname pgfplots@createlegend\endcsname
\endgroup
}%
% makes \addlegendimage available (typically only available within an
% axis environment):
\def\addlegendimage{\csname pgfplots@addlegendimage\endcsname}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\begin{customlegend}[legend style={row sep = 5pt,
/tikz/row 2/.style={row sep = 10pt}
},
legend entries={$a$,$e^x$,C,$d$}]
\addlegendimage{red,fill=black!50!red,area legend}
\addlegendimage{red,fill=black!50!red,sharp plot}
\addlegendimage{red,fill=black!50!red,mark=*,sharp plot}
\addlegendimage{red,fill=black!50!red,ybar,ybar legend}
\end{customlegend}
\end{tikzpicture}
\end{document}



row sepfor every row except one, which I would like to be different. I am trying to set it to be different for a single row, but don't know how. The problem is that what I wrote doesn't work - it compiles without complaining, but leaves all the rows with the samerow sep. – bjorne May 25 '16 at 18:01row sepis not a documented key forlegend styleas far as I can tell. Thepgfplotsmanual only seems to mention it fortable. Why do you think this should work? Does it work in legends for regularpgfplotsplots? – cfr May 25 '16 at 20:35