2

When we are working with lines, it is possible to change the border color of a line using the parameter "double". Another option is to draw a thicker line in the background and use it as border.

But the none of the options seems to work with dotted lines. Is it possible to create a line with several dots that have a border around them?

Thanks!

6
  • Maybe with two dotted lines: densely dotted (like background) and losely dotted options ...
    – juanuni
    May 29 '15 at 0:28
  • Or maybe two dotted lines with very thick (like background) and (for second line) thin, very thin or without options ...
    – juanuni
    May 29 '15 at 0:39
  • Thanks for the answer. It didn't work because the size of the dots were determined by the line width, so the very thick didn't have any effect :(. If I increase the line width the dots does not fall in the same spot :(. May 29 '15 at 2:49
  • You should explicitly defined length of line segments and space between them.
    – Zarko
    May 29 '15 at 3:29
  • Yes, but how to fit one exactly over the other if the size of the dots are different? May 29 '15 at 5:28
6

Your requirements are not very clear... Here is a proposition:

enter image description here

\documentclass[tikz,margin=2mm]{standalone}

\usetikzlibrary{decorations.markings}

\tikzset{
  dotted bordered/.style={
    decorate,decoration={markings,
      mark=between positions 0 and 1 step 6pt with {
        \draw[line width=.3pt,#1,fill=none] circle(2pt);
        \fill[#1,draw=none] circle(1pt);
      }
    },
  },
}
\begin{document}
\begin{tikzpicture}
  \draw[dotted bordered={fill=violet,draw=green}]
  (0,0) -- (3,1) -- (1,3) to[out=180,in=90] (0,1);

  \draw[dotted bordered=red] (1.5,1.5) circle(1cm);
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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