2
$\begingroup$

i need some help to plot a three colored Trefoil knot. I found on Wolfram the code

Graphics[Transpose[{{Red,Blue,Green,Red},KnotData["Trefoil","KnotDiagramData"]}]]

for the three colored Trefoil but i want the line segments thicker.

Can someone help me please and maybe give a another example for a 3-color Knot?

$\endgroup$
1
  • $\begingroup$ Try using Directive[Thickness[.05], #] & /@ {Red, Blue, Green, Red} instead of {Red, Blue, Green, Red}. $\endgroup$
    – b3m2a1
    Commented Nov 10, 2017 at 20:42

1 Answer 1

3
$\begingroup$

You can pack all of that styling into a Directive.

For a general function that'll work no matter what styling choices, you can try this:

With[{
  d = KnotData["FigureEight", "KnotDiagramData"],
  individualStyles = {Red, Blue, Green, Pink},
  commonStyles = Thickness[.05]
  },
 Graphics[
  Transpose[{
    Directive @@ Flatten[{commonStyles, #}] & /@

     Take[Flatten@ConstantArray[individualStyles, Length@d], Length@d],
    d
    }]]
 ]

asd

Just tweak the stuff in the With variable declarations

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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