2

Drawing inspiration from the question TikZ: Get values for predefined dash patterns, I would like to draw a node using a dash pattern that uses multiple color. The pgfmanual entry on dash pattern states that the syntax for specifying dash patterns is the same as in METAFONT, which I'm not familiar with. I quickly browsed at the Metafun manual (recommended at https://tex.meta.stackexchange.com/a/3427/5471), but I'm still not sure what to do.

1
  • 1
    Why a downvote?
    – Abdallah
    May 21, 2020 at 18:22

1 Answer 1

4

I'm not sure if it's possible to define a dash pattern with more than one color, but you could try something like this:

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

\tikzset{
    dashone/.style={dash pattern=on 3pt off 5pt},
}

\begin{document}
\begin{tikzpicture}
\node[minimum size=3cm, draw, dashone, red, postaction={draw=blue, dash phase=4pt}] {};
\end{tikzpicture}
\end{document}

enter image description here

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.