5
$\begingroup$

I tried the following two ways:

Animate[Plot3D[Sin[x*y^2], {x, -2, 2}, {y, -2, 2}, 
  Axes -> True, 
  Boxed -> True, PlotRange -> {{-2, 2}, {-2, 2}, {-1, 1}}, 
  AxesLabel -> {"x1", "x2", "x3"}, Boxed -> True, PlotPoints -> 100, 
  BoxStyle -> Directive[Gray, Thickness[0.005]], 
  ImageSize -> {500, 400}, 
  ViewPoint -> 3.5 {Cos[t], Sin[t], 0.4}], {t, 0, 2 Pi}, 
  AnimationRate -> 0.01, RefreshRate -> 50]

or

Animate[Plot3D[Sin[x*y^2], {x, -2, 2}, {y, -2, 2}, 
  Axes -> True, 
  Boxed -> True, PlotRange -> {{-2, 2}, {-2, 2}, {-1, 1}}, 
  AxesLabel -> {"x1", "x2", "x3"}, Boxed -> True, PlotPoints -> 100, 
  BoxStyle -> Directive[Gray, Thickness[0.005]], 
  ImageSize -> {500, 400}, 
  ViewVector -> { 6 {Cos[t], Sin[t], 0.4}, {0, 0, 0}}, 
  ViewAngle -> All, SphericalRegion -> True, 
  ViewVertical -> {0, 0, 1}], {t, 0, 2 Pi}, AnimationRate -> 0.01, 
  RefreshRate -> 50]

I would like to rotate the plot around the z-axis (around {0, 0, 1} vector) with Boxed -> True and Ticks and Axes->True and with ticks and axis labels.

The two Animate expressions shown above work but the motion is not smooth (there are some jumps in rotation).

Does anybody have some idea how to improve the animation to make the motion smooth.

$\endgroup$
  • 1
    $\begingroup$ is it necessary to run it live? you can try exporting it so the final result is more smooth and isn't hard on your system. you can check it out here $\endgroup$ – Siav Josep Aug 12 '16 at 15:14
  • $\begingroup$ Try adding ImagePadding -> 50 to the Animate function. $\endgroup$ – JimB Aug 12 '16 at 15:40
  • $\begingroup$ ViewVector ->Dynamic @ { 6 {Cos[t], Sin[t], 0.4}, {0, 0, 0}} will greatly improve performance but those tiny glitches still happen $\endgroup$ – Kuba Aug 12 '16 at 15:58
  • $\begingroup$ What if you add RotationAction -> "Clip"? $\endgroup$ – J. M. is away Aug 12 '16 at 16:46
3
$\begingroup$

The jumpiness of the first Animate occurs when the axes labels switch from on side to another. Adding in ImagePadding -> 50 makes this Animate as "smooth" as your second Animate. If you need additional smoothness, then something else would need to be done but at least adding in the padding gets rid of the jumps.

Animate[Plot3D[Sin[x*y^2], {x, -2, 2}, {y, -2, 2}, Axes -> True, 
  Boxed -> True, PlotRange -> {{-2, 2}, {-2, 2}, {-1, 1}}, 
  AxesLabel -> {"x1", "x2", "x3"}, Boxed -> True, PlotPoints -> 100, 
  BoxStyle -> Directive[Gray, Thickness[0.005]], 
  ImageSize -> {500, 400}, ImagePadding -> 50, 
  ViewPoint -> 3.5 {Cos[t], Sin[t], 0.4}], {t, 0, 2 Pi}, 
 AnimationRate -> 0.01, RefreshRate -> 50] 
$\endgroup$
  • $\begingroup$ Thank you very much for all comments and answers. Is there a way to MAKE the axes labels, ticks, ticks labels NOT to switch from on side to another (not floating) during the animation (motion, rotation)? TIA Andrew $\endgroup$ – Andrew Aug 12 '16 at 17:34
  • $\begingroup$ Andrew, that's an excellent question you should ask separately. I'd really like to know the answer that that one, too. And to reiterate @J.M.'s suggestion, using `RotationAction -> "Clip" will fix jumpiness when you are manually rotating a 3D object (although I, too, thought it might fix the problem here). $\endgroup$ – JimB Aug 12 '16 at 18:37
  • 1
    $\begingroup$ @Andrew in order to make the axes NOT to switch you might try the option AxesEdge->{{-1,-1},{-1,-1},{-1,-1}}, hope that helps $\endgroup$ – MaTECmatica Aug 12 '16 at 20:25
  • $\begingroup$ @Andrew, to be fair, all you said was that the animation was "not smooth", but you neglected to mention what parts of the animation were jumpy. If you'd mentioned that the ticks and labels were bothering you, you could have gotten solutions more readily. $\endgroup$ – J. M. is away Aug 13 '16 at 2:15
2
$\begingroup$

You need to use the Plot3D option AxesEdge->{{-1,-1},{-1,-1},{-1,-1}} with the Plot3D option SphericalRegion->True, next one has no jumpling nor rescaling:

Animate[Plot3D[Sin[x*y^2], {x, -2, 2}, {y, -2, 2}, 
Axes -> True, Boxed -> True, PlotRange -> {{-2, 2}, {-2, 2}, {-1, 1}}, 
AxesLabel -> {"x1", "x2", "x3"}, Boxed -> True, 
PlotPoints -> 100, 
BoxStyle -> Directive[Gray, Thickness[0.005]], 
ImageSize -> {500, 400}, 
SphericalRegion -> True, AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}}, 
ViewPoint -> 3.5 {Cos[t], Sin[t], 0.4}], 
{t, 0, 2 Pi}, AnimationRate -> 0.01, RefreshRate -> 50]

Hope that helps

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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