howardwilk
(Howard Wilk)
1
I can color a helix with 2 colors:
ParametricPlot3D[{Sin[t], Cos[t], t/3}, {t, 0, 15},
ColorFunction -> Function[{x, y, z, t}, If[t < 5, Red, Green]],
ColorFunctionScaling -> False]
But I can’t figure out how to color with 3 colors, say, t < 5 red, 5<=t<=10 green, t>10 blue.
iliang
(Ilian Gachevski)
2
Instead of If[t < 5, Red, Green], it could be Piecewise[{{Red, t < 5}, {Green, 5 <= t <= 10}, {Blue, t > 10}}] .
ParametricPlot3D[{Sin[t], Cos[t], t/3}, {t, 0, 15},
ColorFunctionScaling -> False,
ColorFunction ->
Function[{x, y, z, t},
Piecewise[{{Red, t < 5}, {Green, 5 <= t <= 10}, {Blue, t > 10}}]]]
howardwilk
(Howard Wilk)
3
I got it! Thank you very much.