Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to have it so that the plot marks would be filled and drawn, but the actual path wouldn't be drawn?

Here is example where it is otherwise the way I'd like, except those dots' should be filled with white:

\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

enter image description here

And here the dots are the way I would like, but the path is (of course) drawn:

\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

enter image description here

Is there a way to combine the two so that the dots look like in the latter, and the paths like in the former?

share|improve this question
1  
You can include plot command into foreach. This way you plot marks and declare coordinates at same time and can forget two last lines. Something like this worked for me: \foreach \x in {1,...,8} {\path plot[mark=*, mark options={fill=white}] coordinates{(\x,0)} coordinate (n\x); } –  Ignasi Sep 6 '12 at 9:03
    
@Ignasi: Nice! Thanks! –  morbusg Sep 6 '12 at 15:16
add comment

1 Answer

up vote 6 down vote accepted

You have to supply the fill only to the markers. You can do that using 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}
share|improve this answer
    
Ah, I saw that option in the manual but didn't realize it could be used here. Thanks! (Amazingly fast answer, too!) –  morbusg Sep 5 '12 at 18:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.