Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have several curves on the same parametric 3D plot and I would like to highlight some curves dynamically by choosing them from list.

 sol = Solve[ 2 x + 2 x^2 - 3 x^3 + 26 x^4 + 32 x^5 + 21 x^6 - 18 x^7 == r, {x}];
 lolAux[r_] = x /. sol;
 ParametricPlot3D[
    Table[{r, lolAux[r][[i]] // Re, lolAux[r][[i]] // Im}, {i, 1, Length[sol]}], 
 {r, -5, 5}, BoxRatios -> {1, 1, 1}]

enter image description here

How it is possible?

share|improve this question
    
@MichaelE2 Yes. But I Cannot guess how to do it dynamically. –  Филипп Цветков Nov 5 '13 at 20:15
    
This answer may be relevant: Can mathematica solve this equation?. –  Artes Nov 5 '13 at 21:38

3 Answers 3

up vote 1 down vote accepted

Another way. ParametricPlot seems to take apart the list of styles passed via PlotStyle, and wrapping each style in Dynamic caused messages and a red-faced plot. So I resort to this hack of putting a special value in as a style, which has to be a valid directive, and replacing it with a Dynamic style.

sol = Solve[2 x + 2 x^2 - 3 x^3 + 26 x^4 + 32 x^5 + 21 x^6 - 18 x^7 == r, {x}];
lolAux[r_] = x /. sol;
curves = Table[{r, lolAux[r][[i]] // Re, lolAux[r][[i]] // Im}, {i, 1, Length[sol]}];
Manipulate[
  With[{plot = ParametricPlot3D[curves, {r, -5, 5},
      BoxRatios -> {1, 1, 1}, 
      PlotStyle -> Table[Hue[i/Length@curves], {i, Length@curves}]]},
   plot /. 
    Hue[i_] :> 
     Dynamic @ Directive[ColorData[1][i Length@curves], 
       If[MemberQ[highlight, i Length@curves], Thick, Thin]]
   ],
  {{highlight, {}}, 
   Thread[# ->  Column[{#, Graphics[{}, Background -> ColorData[1][#], ImageSize -> 16]}]] & /@
     Range@Length@curves, TogglerBar}
  ]

Manipulate output

share|improve this answer

Well, one way to do it is simply using tooltip

sol = Solve[2 x + 2 x^2 - 3 x^3 + 26 x^4 + 32 x^5 + 21 x^6 - 18 x^7 == r, {x}];

lolAux[r_] = x /. sol;

tip = Table[Tooltip[{r, lolAux[r][[i]]//Re, lolAux[r][[i]] // Im}, i], {i, 1, Length[sol]}];

ParametricPlot3D[tip, {r, -5, 5}, BoxRatios -> {1, 1, 1}]

enter image description here

share|improve this answer

Here's one way. You have to change 2 in Array to the number of functions you're plotting, and also the list of functions that can be selected. The number is their corresponding position in the list of functions.

Array[ColorData[1], 2] generates a list of length two, filled with the colors that Mathematica uses by default for the first two lines in a plot.

Of course you can change the plot style in other ways than just making the line thicker.

Manipulate[
 ParametricPlot3D[
  {{Sin[u], Cos[u], u/10}, 0.5 {Cos[u], Sin[u], u/10}}, {u, 0, 20},
  PlotStyle -> 
   MapAt[{Thick, #} &, Array[ColorData[1], 2], List /@ selected]
  ],
 {{selected, {}}, {1, 2}, CheckboxBar}]

scrn

share|improve this answer

Your Answer

 
discard

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.