# Custom Spacing on PGF legend

I'm trying to change the spacing of a single legend entry in a PGF bar plot. This is my MWE:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ybar]
\addplot coordinates {(1,3) (2,5) (3,2)};
\addplot coordinates {(1,2) (2,6) (3,1)};
\addplot coordinates {(1,4) (2,4) (3,4)};
\end{axis}
\end{tikzpicture}
\end{document}


which generates the following figure

What I want is to create a space between (a) and (b) in the legend, while not creating a space between (b) and (c) (that is, I don't want to change the row sep). The ideia is to separate (a) from (b) and (c) in order to highlight that (a) is the result of a work and (b) and (c) are the result of another work in a presentation.

I tried to create a custom legend using \label and \ref, but this changes the bars (in the legend) to lines.

-

You can adjust the spacing of the legend entry by including text depth=2ex, anchor=mid in the \addlegendentry options:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ybar]
\addplot coordinates {(1,3) (2,5) (3,2)};
\addplot coordinates {(1,2) (2,6) (3,1)};
\addplot coordinates {(1,4) (2,4) (3,4)};
\end{axis}
\end{tikzpicture}
\end{document}

-
This works, but it seams that conflicts with every axis legend/.append style={nodes={right}} for some reason (which is not in my MWH, but it is in my real code). But I changed to every axis legend/.append style={nodes={left}} and obtained the desired result. – Rafael Schouery Feb 6 '14 at 10:59
@RafaelSchouery: In that case, you can use anchor=mid west instead of anchor=mid. – Jake Feb 6 '14 at 11:02

Not the best solution, but you could add an empty legend entry with

\addlegendimage{empty legend}


The spacing can be increased by adding a zero width rule in the legend entry, e.g.

\addlegendentry{\rule{0pt}{3pt}}


Change 3pt to modify the spacing.

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ybar]
\addplot coordinates {(1,3) (2,5) (3,2)};