我对 X 标记的可见性有疑问在我的传奇中,使用虚线。我怎样才能让它更清晰,例如,将虚线稍微向右移动一点?(这样标记就位于虚线中间。)
\documentclass{report}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}[%
width=\textwidth,
legend pos = south east,
xlabel=a,
ylabel=b,
]
\addplot[color=black, thick, dashed, samples=10, mark=o, loosely dashed, ,mark options=solid] {x};
\addlegendentry{$x$}
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
多谢!
答案1
标记是居中。要使线条具有对称虚线图案,可以使用 移动线条dash phase
。
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
width=\textwidth,
legend pos = south east,
xlabel=a,
ylabel=b,
]
\addplot[color=black, thick, dashed, dash phase=6.5pt, samples=10, mark=o, loosely dashed ,mark options=solid] {x};
\addlegendentry{$x$}
\end{axis}
\end{tikzpicture}
\end{document}
或者
\addplot[color=black, thick, dashed, dash phase=2pt, samples=10, mark=o, loosely dashed ,mark options=solid] {x};