
Wie erwähnt indiese Fragekann man dash phase
die Position der Leerzeichen zwischen den Strichen eines Diagramms verschieben. Allerdings verschieben sich dadurch auch die Leerzeichen in der Legende.
Ist es möglich, nur im Plot die Leerzeichen zu verschieben und die Legende dabei unverändert zu lassen?
MWE
\begin{tikzpicture}
\begin{axis}[
width=3in,
height=3in
]
\addplot [black, dashed]
table {%
0 0
1 1
2 0
3 -.5
};
\addlegendentry{w/o dash phase}
\addplot [black, dashed, dash phase = 8pt]
table {%
1 0
2 1
3 0
4 -.5
};
\addlegendentry{w/ dash phase}
\end{axis}
\end{tikzpicture}
was gibt
Antwort1
Dies ist der Zweck von legend image post style
. Sie können es verwenden, um das zurückzusetzen dash phase
.
\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=3in,
height=3in,legend image post style={dash phase=0pt},
]
\addplot [black, dashed]
table {%
0 0
1 1
2 0
3 -.5
};
\addlegendentry{w/o dash phase}
\addplot [black, dashed, dash phase=8pt]
table {%
1 0
2 1
3 0
4 -.5
};
\addlegendentryexpanded{w/ dash phase}
\end{axis}
\end{tikzpicture}
\end{document}