# How to color ParametricPlot3D based on the parameter?

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.

Cheers!

• Look in the details section too see what arguments are given to the ColorFunction. Function[{x, y, z, t}, ...]
– ssch
Nov 8, 2013 at 14:25

## 1 Answer

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]]]]


• 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 Nov 8, 2013 at 16:20