11
$\begingroup$

I'm trying to make an animated gif of a 3D plot by rotating the plot in its middle, around a vertical axis. I used the tricks gave by F'x and Heike in this thread autorotating 3D plot but I encountered some difficulties to get the right axis (parallel to the Axis3 in code). My need is to rotate my 3D plot slowly as a spinning top from its center.

rotateMeHarder1[g_, vertical_, viewpoint0_, center_List: {0, 0, 0}, nframes_Integer: 15, opts : OptionsPattern[]] := Module[{grlist}, grlist = Table[ Show[g, ViewVertical -> vertical, ViewVector -> {RotationMatrix[2 Pi/nframes i, vertical].(viewpoint0 - center) + center, center}, SphericalRegion -> True, opts], {i, 0, nframes - 1}]] p = ListPlot3D[data, Mesh -> All, AxesLabel -> {"Axis1", "Axis2", "Axis3"}, PlotRange -> Full] grlist = rotateMeHarder1[p, {0, 0, 1}, {1, 1, 1}, {0, 0, 0}, 10, ViewAngle -> 110 Degree] ListAnimate[grlist] 
$\endgroup$
5
  • 1
    $\begingroup$ Also related: mathematica.stackexchange.com/q/2565/12 $\endgroup$ Commented Apr 20, 2012 at 12:54
  • 1
    $\begingroup$ also related stackoverflow.com/a/5603326/353410 , stackoverflow.com/a/5377618/353410 $\endgroup$ Commented Apr 20, 2012 at 12:57
  • $\begingroup$ I think that my problem come from the fact that don't understand how work ViewVector, ViewCenter, etc... and that documentation in mathematica is not sufficiently explicit for me: ViewVector -> {{5, -5, 5}, {5, 0, -5}} those 2x3 numbers rely to what? thanks for advices. Where/how can I find the coordinates of the edges of a graphe and its center? $\endgroup$ Commented Apr 20, 2012 at 13:15
  • $\begingroup$ You might want to look into how the old function SpinShow[] in the old package Graphics`Animation` was implemented... $\endgroup$ Commented Apr 20, 2012 at 13:56
  • 1
    $\begingroup$ More related: mathematica.stackexchange.com/a/3538/57 $\endgroup$ Commented Apr 20, 2012 at 19:55

1 Answer 1

19
$\begingroup$

I suppose you don't want something like this? (Sorry about the 750KB GIF...)

stupid animated gif

data = Table[Sin[x y], {x , 0, Pi, Pi/20}, {y, 0, Pi, Pi/20}]; animation = Table[ListPlot3D[data, DataRange -> {{-1, 1}, {-1, 1}}, SphericalRegion -> True, Axes -> False, Boxed -> False, ViewVector -> {5 Sin[t], 5 Cos[t], Sin[10 t]}], {t , 0, Pi, Pi/40}]; Export["animated.gif", animation, "DisplayDurations" -> .1] 
$\endgroup$
4
  • 2
    $\begingroup$ Are we drunk, or on a ship? $\endgroup$ Commented Apr 21, 2012 at 6:45
  • 6
    $\begingroup$ @Mr.Wizard It's "Plot like a pirate" day... $\endgroup$ Commented Apr 21, 2012 at 7:24
  • $\begingroup$ Drink up, me 'earties, yo ho. :-) $\endgroup$ Commented Apr 21, 2012 at 14:07
  • $\begingroup$ will be perfect if it gave me an infinite rotating style and a sailing on a smoother sea ;-) Really thanks for the helps guys and Yo-ho-ho! $\endgroup$ Commented May 10, 2012 at 8:50

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.