Occasionally we have legend entries which are of quite different sizes (lengths). This results in wasted real estate when legends are within the axis, and very large plots when they are outside the axis. If there are, for instance, roughly two lengths of legend entries (short and long) as shown below, it would be convenient to have a single legend box with customised dimensions.
My workaround for this has been to just create separate legend boxes:
\documentclass[convert]{standalone}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[legend pos=south west, domain=0:100, no marks]
\addplot+[orange] {0};
\addlegendentry{long legend entry indeed}
\addplot {-x + 1}; \label{a}
\addplot {-x + 4}; \label{b}
\addplot {-x + 9}; \label{c}
\addplot {-x + 1}; \label{d}
% Desired look of legend box
\draw (60,0) -- (80,0) -- (80, -20) -- (100,-20) -- (100, -30) -- (60, -30) -- (60, 0);
\end{axis} % The following is quite tedious
\begin{axis}[axis x line=none, axis y line=none, legend style={at={(axis cs:-5.63, -0.5)}, anchor=south west},]
\addplot[opacity=0, forget plot] {0};
\addlegendimage{/pgfplots/refstyle=a} \addlegendentry{$c_1$}
\addlegendimage{/pgfplots/refstyle=b} \addlegendentry{$c_2$}
\addlegendimage{/pgfplots/refstyle=c} \addlegendentry{$c_3$}
\addlegendimage{/pgfplots/refstyle=d} \addlegendentry{$c_4$}
\end{axis}
\end{tikzpicture}
\end{document}
Notice that if a single legend box was used, it would cover up a substantial region of the plot. This post looks relevant, although legend style options such as text depth operate globally.

