Message Boards Message Boards


Assigning three colors to a curve in ParametricPlot3D using PlotStyle?

Posted 2 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
Posted 2 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

Hi Rohit Thank you for your help.

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

Group Abstract Group Abstract