I am trying to reproduce the following diagram in TikZ (it is a knot diagram for the figure eight knot, but that is not important):

A pair of nested spiral curves.

It consists of two nested spirals and two horizontal segments. Preferably the spirals should be smooth, but it is OK if they are `kinky' at the intersection points with the horizontal segments, the only constraint is that the two spirals don't intersect.

I have tried to use \draw plot [smooth] ... as described in the earlier question Easy curves in TikZ:

    \node(L0) at (-1.5,0) {};
    \node(L1) at (-2.5,0) {};
    \node(L2) at (-3.5,0) {};
    \node(L3) at (-4.5,0) {};
    \node(L4) at (-5.5,0) {};
    \node(L5) at (-6.5,0) {};
    \node(L6) at (-7.5,0) {};
    \node(R0) at (1.5,0)  {};
    \node(R1) at (2.5,0)  {};
    \node(R2) at (3.5,0)  {};
    \node(R3) at (4.5,0)  {};
    \node(R4) at (5.5,0)  {};
    \node(R5) at (6.5,0)  {};
    \node(R6) at (7.5,0)  {};
    \node(ML) at (-0.5,0) {};
    \node(MR) at (0.5,0) {};

    \draw plot [smooth, tension=2] coordinates {(L0) (R3) (L6) (L4) (R1) (MR) (L2) (R5)};
    \draw plot [smooth, tension=2] coordinates {(L5) (R2) (L1) (ML) (R4) (R6) (L3) (R0)};
    \draw (L0)--(L5);
    \draw (R0)--(R5);

but this just produces a straight line (from my limited understanding of the algorithm used by TikZ this is because the tangent to the curve at any point is the line joining the preceeding and succeeding points, and all the points in my diagram are collinear).

I have also attempted to use the hobby library, but was unsuccessful, the result being hopelessly tangled:

Result of the hobby library

(This was produced by replacing the two \draw lines above with

    \draw (L0) to[quick curve through={(R3) (L6) (L4) (R1) (MR) (L2)}] (R5);
    \draw (L5) to[quick curve through={(R2) (L1) (ML) (R4) (R6) (L3)}] (R0);

and perhaps it could be fixed by choosing the right options in the hobby package.)

Question. Is there a way of reproducing the `nested spiral' diagram pictured above by just specifying the points for the curves to go through in order? If not, what is the easiest way to reproduce the diagram in TikZ?

  • Have you tried the knots library? Commented Feb 11 at 0:10
  • @Crazymoomin thanks, I haven't used it before because it's always seemed very "heavy" but I gave it a go and it seems to work much better than the other things I've tried (only problem is longer compile time). I self-answered, thanks very much! Commented Feb 11 at 0:44

1 Answer 1


Thanks to suggestion by Crazymoomin in comments, I have tried the knots library and it gives much better results:

  \node[draw=none](L0) at (-1.5,0) {};
  \node[draw=none](L1) at (-2.5,0) {};
  \node[draw=none](L2) at (-3.5,0) {};
  \node[draw=none](L3) at (-4.5,0) {};
  \node[draw=none](L4) at (-5.5,0) {};
  \node[draw=none](L5) at (-6.5,0) {};
  \node[draw=none](L6) at (-7.5,0) {};
  \node[draw=none](R0) at (1.5,0)  {};
  \node[draw=none](R1) at (2.5,0)  {};
  \node[draw=none](R2) at (3.5,0)  {};
  \node[draw=none](R3) at (4.5,0)  {};
  \node[draw=none](R4) at (5.5,0)  {};
  \node[draw=none](R5) at (6.5,0)  {};
  \node[draw=none](R6) at (7.5,0)  {};
  \node[draw=none](ML) at (-0.5,0) {};
  \node[draw=none](MR) at (0.5,0) {};
    \strand [thick] (L0)
      to[out=north,in=north] (R3)
      to[out=south,in=south] (L6)
      to[out=north,in=north] (L4)
      to[out=south,in=south] (R1)
      to[out=north, in=north] (MR)
      to[out=south,in=south] (L2)
      to[out=north, in=north] (R5);

    \strand [thick] (L5)
      to[out=south,in=south] (R2)
      to[out=north,in=north] (ML)
      to[out=south,in=south] (L1)
      to[out=north,in=north] (R4)
      to[out=south, in=south] (R6)
      to[out=north,in=north] (L3)
      to[out=south, in=south] (R0);

    \strand[thick] (L0) to (L5);
    \strand[thick] (R0) to (R5);

enter image description here

Of course I need to remove the under/overcrossings but this is not a problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .