Message Boards Message Boards


Assigning three colors to a curve in ParametricPlot3D using PlotStyle?

Posted 3 months ago
2 Replies
0 Total Likes

Why does this not work?

ParametricPlot3D[{t, t, t}, {t, 0, 3},  PlotStyle -> {If[1 <= t <= 2, Red, Green]}]
2 Replies

Hi Rohit Thank you for your help.

Posted 3 months ago

Hi Mariano,

You need to use a ColorFunction to do that. e.g.

ParametricPlot3D[{t, t, t}, {t, 0, 3}, 
 ColorFunction -> Function[{x, y, z, u}, If[Between[x, {1, 2}], Red, Green]],
 ColorFunctionScaling -> False]

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract