I'd like to show students a graph of a function, say $(x,y)\mapsto\sqrt[3]{x^3+y^3}$, and then highlight its various properties connected with (non)differentiability at certain points etc. Having some lines included in the graph seems a good idea. Now I'd like to be able to highlight (by using different colors and/or thicker lines) some of these lines. It would be best if I could press or click something so that one or another line gets "selected" (highlighted). How to achieve something like this?

Note: I'll be fully satisfied with one-line, RTFM-style answers, if someone could provide me a hint where to look for the FM; I'm new to Mathematica and feel a bit overwhelmed by the multitude of documentation in various formats...


1 Answer 1


In addition to my comment, I guess I could also point out that Mathematica plots can be combined using the Show command. So you could define two different plots as follows and then combine them:

f[x_, y_] := (x^3 + y^3)^(1/3)

surface = Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}];

line = ParametricPlot3D[
   With[{x = t, y = t}, {x, y, f[x, y]}], {t, 0, 2}, 
   PlotStyle -> {Red, Tube[.03]}];

Show[surface, line]



Looks like you may also want to read about Manipulate, as shown in this example:

  ParametricPlot3D[With[{x = t, y = t}, {x, y, f[x, y]}], {t, 0, 2}, 
   PlotStyle -> {style, Tube[.03]}]],
 {style, {Red, Directive[Opacity[.5], Blue]}}]


Here I just added the bare minimum to the previous example to make the color of the added line controllable by clicking a button.


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.