Consider the following simple example:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\coordinate (a) at (0,0);
\coordinate (b) at (1,1);
\coordinate (c) at (2,0);
\draw (a) -- (b) -- (c);
\fill (a) circle (2pt);
\fill (b) circle (2pt);
\fill (c) circle (2pt);
\end{tikzpicture}
\end{document}
I am interested in improving this code. In particular I would like to avoid the manual drawing of the circles. Have in mind a case where many vertices are involved with many different names.
I know I could replace the fill's with some loop like
\foreach \i in {a,b,c}
\fill (\i) circle (2pt);
But I'm interested in more global magic, that is a way to fill a circle (or any other shape) of some fixed radius radius (or dimension) whenever TikZ meets a coordinate.
A bonus would be a solution which can be switched off for certain vertices. I believe the solution is to use style
's but I don't know how to do it.
Best Answer
With a
plot
you can usemark
s. This allows to use the marks*
,x
,+
andball
. More plot marks can be loaded with theplotmarks
library.Available options are
mark
,mark repeat
,mark phase
,mark indices
,mark size
,every mark
,mark options
(which simply setsevery mark
) andno marks
andno markers
(which are the same asmark=none
).and with the
plotmarks
librarymark color
(for the other color of the starred half versions),text mark
(text used for thetext
mark),text mark as node
andtext mark style
Code
Output