I'm trying to draw a single link diagram (like the one here: https://loopspace.mathforge.org/HowDidIDoThat/TeX/Knots/#section.5) using the knots library:
\begin{tikzpicture}
\begin{knot}[
flip crossing=2
]
\strand (1,0) circle[radius=2cm];
\strand[blue] (-1,0) circle[radius=2cm];
\end{knot}
\end{tikzpicture}
However, I'd like one of my circles to have two colours. The idea is that the link represents the closure of a three-strand braid, and one of the circles in the link comes from two of the strands, so I thought it would be nice to colour it to show that.
Initially, I was thinking of something like this: How to draw a double-color line with tikz . However, when I changed my \strand[blue] to \strand[draw=blue,dash pattern= on 3pt off 5pt,thick,postaction={draw,red,dash pattern= on 3pt off 5pt,dash phase=4pt,thick}](-1,0) circle[radius=2cm];, the crossing gaps no longer show up:
I also tried an alternative approach using a gradient from this question Path following color gradient in TikZ, but, again, the crossing gaps vanished.
I'm assuming the knot library is somehow not applying the gap rule to the postaction / decoration? Is there an appropriate way to draw a two-coloured strand using the knots library?


knotlibrary? You can realize the drawing from scratch. – Daniel N Jan 16 '24 at 16:46only when renderingkey. The knots library uses a copy of the strand to "wipeout" the understand, so you don't want it to have gaps when it does so. – Andrew Stacey Jan 16 '24 at 18:42only when renderingkey as well. – Andrew Stacey Jan 16 '24 at 18:44background colour=yellowor some other non-background colour can be very useful to see what's going on. This shows what the "cutting path" looks like. Removing thepostaction(as that has other issues) but keeping thedashpattern shows that the lower intersection point gets missed by the dash on the cutting path. – Andrew Stacey Jan 16 '24 at 22:47