1
$\begingroup$

How can I automatically spin a contour 3D plot around its axis? I created a contour 3D plot of a hyperbolic geodesic but couldn't seem to find a function to make it automatically rotate.

Here is the code I used to create the hyperbolic geodesic:

ContourPlot3D[
  x^2 +  y^2 - a z^2 == 1, {x, -5, 5}, {y, -5, 5}, {z, -2, 2}, 
  PlotTheme->"Web"]
$\endgroup$
3
  • 2
    $\begingroup$ resources.wolframcloud.com/FunctionRepository/resources/… $\endgroup$
    – Greg Hurst
    Commented Apr 27, 2020 at 18:21
  • $\begingroup$ Thanks Chip! Tried that but the geodesic didn't seem to spin. Could you please suggest a code to spin the geodesic automatically. $\endgroup$ Commented Apr 27, 2020 at 19:30
  • $\begingroup$ Is this what you are looking for? ResourceFunction["SpinShow"][ ContourPlot3D[ x^2 + y^2 - 3 z^2 == 1, {x, -5, 5}, {y, -5, 5}, {z, -2, 2}, PlotTheme -> "Web", Axes -> False, Boxed -> False]]? $\endgroup$ Commented Apr 27, 2020 at 21:15

1 Answer 1

1
$\begingroup$

You can do with Animate:

plot = ContourPlot3D[
  x^2 + y^2 - z^2 == 1, {x, -5, 5}, {y, -5, 5}, {z, -2, 2}, 
  PlotTheme -> "Web"]

Animate[Show[plot, SphericalRegion -> True, 
  ViewPoint -> RotationTransform[t, {0, 0, 1}][{3, 0, 3}]], {t, 0, 
  2 Pi}]

or Dynamic with Clock:

Show[plot, 
 ViewPoint -> 
  Dynamic[RotationTransform[Clock[{0, 2 Pi}, 5], {0, 0, 1}][{3, 0, 
     3}]], SphericalRegion -> True]

or

ContourPlot3D[
 x^2 + y^2 - z^2 == 1, {x, -5, 5}, {y, -5, 5}, {z, -2, 2}, 
 PlotTheme -> "Web", 
 ViewPoint -> 
  Dynamic[RotationTransform[Clock[{0, 2 Pi}, 5], {0, 0, 1}][{3, 0, 
     3}]], SphericalRegion -> True]
$\endgroup$
2
  • $\begingroup$ Thank you @halmir $\endgroup$ Commented Apr 28, 2020 at 7:45
  • $\begingroup$ I tried the code suggested by you and could see the viewpoint coordinate values are changing and the slider seems to be moving, but the visualisation does not seem to be spinning. I tried several options, but haven't succeeded in making the rendered object spin. Would there be any additional suggestions to make the visualisation spin? $\endgroup$ Commented Apr 28, 2020 at 9: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.