# Moving axes in animation

I'm having trouble creating a smooth animation which zooms in on a plot while the axes stay fixed. The application I have in mind is quite complicated, but the issue already arises in the following simplified version:

Table[Plot[x + 1/6, {x, 1/3 - epsilon, 1/3 + epsilon}, PlotRange -> {1/2 - epsilon, 1/2 + epsilon}, AxesOrigin -> {1/3, 1/2}, Ticks -> False], {epsilon, 3/4, 1/10, -.01}]


The resulting animation stays fixed as expected for the initial frames, then the axes drift right, then they pop back to the center and stay fixed for the rest of the animation: I'm at a loss for what to try, so any help is greatly appreciated!

EDIT: It appears this might be some kind of bug with Mathematica 10.0, it doesn't appear to be reproduceable in some older and newer versions.

• Add options ImagePadding -> None, PlotRangePadding -> None to Plot – Edmund Sep 27 '17 at 22:22
• @Edmund I think you should write this as an answer, rather than a comment. +1 – Alexei Boulbitch Sep 28 '17 at 6:53
• With Edmunds hint you can try: Manipulate[Plot[x + 1/6, {x, 1/3 - epsilon, 1/3 + epsilon}, PlotRange -> {1/2 - epsilon, 1/2 + epsilon}, AxesOrigin -> {1/3, 1/2}, PlotRangePadding -> None, PlotRangePadding -> None], {epsilon, 3/4, 1/10, -.01}] – mrz Sep 28 '17 at 11:05

## 1 Answer

You may use the ImagePadding and PlotRangePadding options of Plot to control the extra automatically calculated spacings that are applied.

plots =
Table[
Plot[x + 1/6, {x, 1/3 - epsilon, 1/3 + epsilon},
PlotRange -> {1/2 - epsilon, 1/2 + epsilon},
AxesOrigin -> {1/3, 1/2},
ImagePadding -> None,
PlotRangePadding -> None
],
{epsilon, 3/4, 1/10, -.01}];
ListAnimate[plots] Hope this helps.

• Thanks for the answer. For some reason when I tried my original code at home (On Mathematica 9.0) it worked just fine. I'll have to try your solution at work (Mathematica 11.something) to see if it fixes the issue. I had played around with some of the padding options but they didn't seem to help. – Jack Huizenga Sep 28 '17 at 14:04
• @JackHuizenga This answer is on version 11.2, if that helps. – Edmund Sep 28 '17 at 15:15
• Turns out my version at work is 10.0, and the above code produces the same output (+tick marks) as the original example I provided. Guess that's a reason to update to the latest version. Thanks! – Jack Huizenga Sep 29 '17 at 15:03