I have a set of ODEs I am solving, and then plotting (several) trajectories of in ParametricPlot3D. I want to have a color of each plot reflect the time (i.e. the Parameter) at that point.

I tried what something along the lines of:

ParametricPlot3D[{{Sin[t], Cos[t], t/10}, {Sin[2*t], 3*Cos[t], Tan[t]}}, {t, 0, 20},
ColorFunction -> Function[t, Hue[t]]]

which colors the function in a seemingly arbitrary way.


  • 1
    $\begingroup$ Look in the details section too see what arguments are given to the ColorFunction. Function[{x, y, z, t}, ...] $\endgroup$ – ssch Nov 8 '13 at 14:25
ParametricPlot3D[{{Sin[t], Cos[t], t/10}, {Sin[2*t], 3*Cos[t], Tan[t]}}, {t, 0, 2 Pi}, 
                 ColorFunction -> Function[{x, y, z, t}, Hue[t]], 
                 PlotStyle -> Thick,
                 Exclusions -> Thread[Equal[t, Array[(2 # - 1)/2 Pi &, 2]]]]

Mathematica graphics

| improve this answer | |
  • $\begingroup$ Please note that extending the plot till t == 20 as you've done will cause the second function to plot along the same path several times, so occluding the "real" coloring $\endgroup$ – Dr. belisarius Nov 8 '13 at 16:20

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.