# Jumpy exported animation

When I make an animation of Plot3D using ListAnimate it looks decent. But when I export the same frames with Export, the z-axis tick labels jump back and forth. Here's a minimal example:

f = Table[
Plot3D[(1 + Sin[2 \[Pi] t]) E^(-(x - Sin[2 \[Pi] t])^2 - (y - Cos[2 \[Pi] t])^2),
{x, -2, 2}, {y, -2, 2}, PlotLabel -> t, PlotRange -> All, ViewPoint -> {-2, -2, 1}]
, {t, 0, 0.95, 0.05}];

ListAnimate[f]
(* looks OK *)

Export["f.gif", f, "AnimationRepetitions" -> \[Infinity]]


Any idea how I can get Export to behave like ListAnimate?

• Try a fixed PlotRange, like {{-2,2},{-2,2},{0,2}} instead of All Commented Jul 8, 2020 at 2:26
• @flinty But what if one just needs PlotRange->All? Commented Jul 8, 2020 at 2:49
• @JimB The weird thing is the changing height of the z-axis doesn't cause ListAnimate the same problem where the ticks switch back and forth from the left to right side. Luckily @TimLaska's answer fixes the problem. Commented Jul 8, 2020 at 3:21
• @ChrisK But just using PlotRange -> {All, All, {0, 2}} gives the desired result with ListAnimate and Export (Mathematica 12.0, Windows 10).
– JimB
Commented Jul 8, 2020 at 3:30
• It might be that several things reduce the jumpiness. Just adding in SphericalRegion->True reduces the jumpiness in ListAnimate. So does adding ImagePadding -> 30 (by itself without SphericalRegion).
– JimB
Commented Jul 8, 2020 at 3:44

You could try adding ImagePadding and AxesEdge to prevent the axes from jumping around.

f = Table[
Plot3D[(1 +
Sin[2 π t]) E^(-(x - Sin[2 π t])^2 - (y -
Cos[2 π t])^2), {x, -2, 2}, {y, -2, 2}, PlotLabel -> t,
PlotRange -> All, ViewPoint -> {-2, -2, 1},
ImagePadding -> {{40, 0}, {0, 0}},
AxesEdge -> {{-1, 1}, {-1, 1}, {-1, 1}}], {t, 0, 0.95, 0.05}];

ListAnimate[f]

Export["f.gif", f, "AnimationRepetitions" -> ∞]


• Seems that ImagePadding isn't necessary? Commented Jul 8, 2020 at 2:53
• @xzczd Maybe. I saw some vibrations with the box when I commented it out on my windows machine (12.1.1 for Microsoft Windows (64-bit) (June 19, 2020)). I also saw some clipping of the z-axis. Commented Jul 8, 2020 at 2:57
• Perfect, this fixed both my minimal example and my real problem. Thanks! Commented Jul 8, 2020 at 3:19
• This solution does not visualize the height changes. Just number at the z-axis is dancing, but this is bad way. I guess the fixed PlotRange at highest value will give the best. Commented Jul 8, 2020 at 4:30