我使用 关闭了文档前言中的标记\pgfplotsset{no markers}
。现在我想让一个特定的图显示标记,同时希望保留no markers
文档其余部分的全局标记。以下是我尝试过的方法:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{no markers}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot coordinates { (1,1) (2,2) (3,2) };
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[mark options={*}]% does not work
\addplot coordinates { (1,1) (2,2) (3,2) };
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[mark options={*}]% does not work
\addplot[mark=*] coordinates { (1,1) (2,2) (3,2) };% does not work, but strangely changes line color to black?
\end{axis}
\end{tikzpicture}
\end{document}
我如何才能只打开特定图表的标记,同时关闭文档其余部分的标记?
答案1
问题是no markers
定义为
/pgfplots/no markers/.style={/pgfplots/every axis plot post/.append style={mark=none}},
意思是它在情节结束时才有悬念。所以你可能想在更晚的时候才有悬念,例如
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{no markers}
\pgfplotsset{but I really want a mark/.style={/pgfplots/every axis plot
post/.append style={mark=#1}}}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot coordinates { (1,1) (2,2) (3,2) };
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[but I really want a mark={*}]% works
\addplot coordinates { (1,1) (2,2) (3,2) };
\end{axis}
\end{tikzpicture}
\end{document}