
前述の通りこの質問を使用すると、dash phase
プロットのダッシュ間の空白の位置を移動できます。ただし、これにより凡例の空白も移動します。
凡例を変更せずに、プロット内の空白のみを移動することは可能ですか?
ムウェ
\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}
これにより
答え1
これが の目的ですlegend image post style
。これを使用して をリセットできます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}