Is there an option, or simple work-around, for coloring each strand in a three-dimensional BraidImage differently? For instance, I'd like to render a braid image such as

KnotData[{4, 1}, "BraidImage"]

in red, green and blue.

  • 4
    $\begingroup$ it's a hack, but i = 1; KnotData[{4, 1}, "BraidImage"] /. {y_GraphicsComplex} :> {{Red, Green, Blue}[[i++]], y} $\endgroup$
    – Jason B.
    Nov 7 '17 at 22:46
  • 1
    $\begingroup$ @JasonB. Great solution! $\endgroup$ Nov 7 '17 at 22:48
  • $\begingroup$ Jason: Indeed, perfectly acceptable solution (+1). You can post it as a full solution and if I don't receive a superior solution in a day or so, I'll accept yours. $\endgroup$ Nov 7 '17 at 22:50

Dunno if it's any better than @Jason B.'s answer, but I think "BraidImageData" gives you the graphics objects used in the image, which you can play around with as so, for example:

knotdata = KnotData[{4, 1}, "BraidImageData"];
colors = {Red, Blue, Green};

 Transpose@{colors, knotdata},
 Boxed -> False,
 ViewPoint -> Front


  • 1
    $\begingroup$ Anne: Excellent. Thanks (+1). I'll wait a day or two to accept either this, Jason's or (possibly) someone else's. $\endgroup$ Nov 7 '17 at 22:57
  • $\begingroup$ Great! This is the right way to do it, my solution was just a hack. $\endgroup$
    – Jason B.
    Nov 8 '17 at 1:57

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.