I am having problems to correctly place the legend entries in a 3x3 shaped, transposed legend matrix with empty (skipped) entries for the following MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
legend columns = 3,
transpose legend,
]
\addplot {-x+1};\addlegendentry{A}
\addplot {-x+2};\addlegendentry{B}
\addplot {-x+3};\addlegendentry{C}
\addplot {-x+4};\addlegendentry{D}
\addplot {-x+5};\addlegendentry{E}
\addlegendimage{empty legend}\addlegendentry{skip me}
\addplot {-x+7};\addlegendentry{F}
%\addlegendimage{empty legend}\addlegendentry{skip me}
%\addlegendimage{empty legend}\addlegendentry{skip me}
\end{axis}
\end{tikzpicture}
\end{document}
What I get is:
But what I expect is:
A D F
B E
C
I figured out that I get the expected result by uncommenting the last two empty legend
-lines:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
legend columns = 3,
transpose legend,
]
\addplot {-x+1};\addlegendentry{A}
\addplot {-x+2};\addlegendentry{B}
\addplot {-x+3};\addlegendentry{C}
\addplot {-x+4};\addlegendentry{D}
\addplot {-x+5};\addlegendentry{E}
\addlegendimage{empty legend}\addlegendentry{skip me}
\addplot {-x+7};\addlegendentry{F}
\addlegendimage{empty legend}\addlegendentry{skip me} % <-- Uncommented
\addlegendimage{empty legend}\addlegendentry{skip me} % <-- Uncommented
\end{axis}
\end{tikzpicture}
\end{document}
With this, I get the expected result:
Although I found the solution for my initial problem, I am wondering if this is the expected behavior!? I couldn't find anything related in the PGFPLOTS documentation.