SubplotAnimation

[1]:
import matplotlib.pyplot as plt
import numpy as np
import tqdm

from smpl import animation, plot

Tight

[2]:
%matplotlib notebook
plt.ioff()
for a in tqdm.tqdm(np.linspace(0, 10, 200)):
    fig, axs = plot.subplots(1, 3, figsize=(12, 8), sharey=True)
    fig.subplots_adjust(wspace=0)

    plot.function(lambda x: a * x**2, axes=axs[0], tight=False, xmin=0, xmax=1)
    plot.function(lambda x: a * x**5, axes=axs[0], tight=False, xmin=0, xmax=1)
    plot.function(
        lambda x: a * x**3, axes=axs[1], logx=True, tight=False, xmin=0, xmax=1
    )
    plot.function(lambda x: a * x**1, axes=axs[2], tight=False, xmin=0, xmax=1)
    animation.frame()

# ani.save("test.gif")
ani = animation.animate(interval=10, blit=True)
plt.show()
100%|██████████| 200/200 [00:06<00:00, 28.68it/s]

Normal

[3]:
%matplotlib notebook
plt.ioff()
animation.clear()
for a in tqdm.tqdm(np.linspace(0, 10, 200)):
    fig, axs = plot.subplots(1, 3, figsize=(12, 8), sharey=True)
    fig.subplots_adjust(wspace=0)

    plot.function(lambda x: a * x**2, axes=axs[0], xmin=0, xmax=1)
    plot.function(lambda x: a * x**5, axes=axs[0], xmin=0, xmax=1)
    plot.function(lambda x: a * x**3, axes=axs[1], logx=True, xmin=0, xmax=1)
    plot.function(lambda x: a * x**1, axes=axs[2], xmin=0, xmax=1)
    animation.frame()

# ani.save("test.gif")
ani = animation.animate(interval=10, blit=True)
plt.show()
100%|██████████| 200/200 [00:52<00:00,  3.80it/s]
[ ]:

[ ]:

[ ]: