答案1
您可以通过调整图例的细节pgfplotsset
来调整图例手柄的起点和终点“坐标”,例如,
\pgfplotsset{legend image code/.code={%
\draw plot coordinates {(0cm,0cm) (0.5cm,0cm)};
}
}
以下是 MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{legend image code/.code={
\draw plot coordinates {(0.cm,0cm) (1.5cm,0cm)};
}
}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[legend entries={$E^\ast/E_c=5$, $E^\ast/E_c=3$}]
\addplot[no markers, red] coordinates {(0,0) (0.4, 0.3) (0.8, 0.5)};
\addplot[no markers, blue] coordinates {(0.3, 0) (0.4, 1) (0.9, 0)};
\end{axis}
\end{tikzpicture}
\end{document}