6

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.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Andrew
  • 61
  • 2

2 Answers2

3

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] 
JimB
  • 41,653
  • 3
  • 48
  • 106
  • 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

    – Andrew Aug 12 '16 at 17:34
  • 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). – JimB Aug 12 '16 at 18:37
  • 1
    @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 – MaTECmatica Aug 12 '16 at 20:25
  • @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. – J. M.'s missing motivation Aug 13 '16 at 02:15
2

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

MaTECmatica
  • 588
  • 4
  • 12