# Color Trefoil-Knot

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?

• Try using Directive[Thickness[.05], #] & /@ {Red, Blue, Green, Red} instead of {Red, Blue, Green, Red}. Nov 10 '17 at 20:42

## 1 Answer

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
}]]
]


Just tweak the stuff in the With variable declarations