I'll explain the problem I have with a shorter example, since I'm working with a huge messy function. Suppose we have a real-function $f(t)$, and a curve $C(t) \in \mathbb R^3$. Now, I can use ParametricPlot3d to plot $C(t)$. My question is the following:

How do I color the curve $C(t)$ using the magnitude of $f(t)$ at each point, $P(x(t),y(t),z(t)) \in C(t)$.

I tried tinkering with ColorFunction for this, but was unsuccessful. Any hints would be appreciated.


1 Answer 1


Here is an example. I am making up f[t]

f[t_] := Cos[t]

I also make C[t]

ParametricPlot3D[{Sin[t], Cos[t], t/10}, {t, 0, 20},
 ColorFunction -> Function[{x, y, z, t}, Hue[f[t]]]]

Mathematica graphics

  • $\begingroup$ Am I correct in understanding that the Hue[f[t]] assigns the colors in this case such that the lower magnitudes are red and the higher ones are blue ? $\endgroup$
    – Lelouch
    Jun 8, 2019 at 14:00
  • 2
    $\begingroup$ @Lelouch: Just look up the documentation on Hue. $\endgroup$ Jun 8, 2019 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.