Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
You may find something useful in this question. – Jens Aug 11 '12 at 23:52
@mbork This answer could be useful for you :… – Artes Aug 12 '12 at 17:18

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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