是否可以这样,让情节标记被填充和绘制,但不绘制实际路径?
下面是一个示例,其中的其他部分都是我想要的,只是那些点应该用白色填充:
\input tikz
\usetikzlibrary{shapes.geometric,plotmarks,scopes}
\tikzpicture[bend right, out=60, in=120, max distance=1.5cm]
\foreach \x in {1,...,8} {
\coordinate (n\x) at (\x,0);
}
\draw (n1) to (n3) to (n5) to (n7) to (n1);
\draw (n8) to (n6) to (n4) to (n2) to (n8);
\path plot[fill=white,draw=black,mark=*]
coordinates{(1,0) (2,0) (3,0) (4,0) (5,0) (6,0) (7,0) (8,0)};
\endtikzpicture
这里的点是我想要的样子,但路径(当然)是画出来的:
\input tikz
\usetikzlibrary{shapes.geometric,plotmarks,scopes}
\tikzpicture[bend right, out=60, in=120, max distance=1.5cm]
\foreach \x in {1,...,8} {
\coordinate (n\x) at (\x,0);
}
\draw (n1) to (n3) to (n5) to (n7) to (n1);
\draw (n8) to (n6) to (n4) to (n2) to (n8);
\filldraw[fill=white,draw=black] plot[mark=*]
coordinates{(1,0) (2,0) (3,0) (4,0) (5,0) (6,0) (7,0) (8,0)};
\endtikzpicture
有没有办法将两者结合起来,使得点看起来像后者,而路径看起来像前者?
答案1
您必须fill
为标记提供唯一性。您可以使用以下方式执行此操作mark options={fill=white}
:
\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{shapes.geometric,plotmarks,scopes}
\begin{document}
\begin{tikzpicture}[bend right, out=60, in=120, max distance=1.5cm]
\foreach \x in {1,...,8} {
\coordinate (n\x) at (\x,0);
}
\draw (n1) to (n3) to (n5) to (n7) to (n1);
\draw (n8) to (n6) to (n4) to (n2) to (n8);
\path plot[mark=*, mark options={fill=white}]
coordinates{(1,0) (2,0) (3,0) (4,0) (5,0) (6,0) (7,0) (8,0)};
\end{tikzpicture}
\end{document}