# TikZ: Line with large dots

Is there a simple way to draw a line like with \draw[dotted] (0,0) -- (1,0); but with larger (radius about 1mm) and more distant (about 4mm) dots?

I've looked in the TikZ & PGF manual, section "15.3.2 Graphic Parameters: Dash Pattern" but found nothing useful.

My workaround is using a \foreach and drawing circle nodes.

-

You can use a decoration:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}[decoration={markings,
mark=between positions 0 and 1 step 6pt
with { \draw [fill] (0,0) circle [radius=2pt];}}]
\path[postaction={decorate}] (0,0) to (4,0);
\end{tikzpicture}

\end{document}

Or using decorations.shapes:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.shapes}

\begin{document}

\tikzset{decorate sep/.style 2 args=
{decorate,decoration={shape backgrounds,shape=circle,shape size=#1,shape sep=#2}}}

\begin{tikzpicture}
\draw[decorate sep={2mm}{4mm},fill] (0,0) -- (4,0);
\draw[decorate sep={2mm}{6mm},fill] (0,1) -- (4,1);
\draw[decorate sep={1mm}{4mm},fill] (0,2) -- (4,2);
\end{tikzpicture}

\end{document}

-
Thanks for your help! I like your second solution more, it looks cleaner… –  siegi Apr 22 '12 at 9:10

It's possible with simple options. Logically with dotted, you get only squares or rectangles.

For example :

\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\tikzstyle{dotted}= [dash pattern=on \pgflinewidth off 4mm]
\draw[dotted,line width = 2mm] (0,0) -- (5,0);
\end{tikzpicture}
\end{document}

A strange idea is to use line cap=round to get circles instead squares. A pattern is a rectangle but with line cap=round you get a ice rink and if you reduce the width enough, you get circles. The method is funny.