Created
November 6, 2018 19:05
-
-
Save ImportanceOfBeingErnest/f44d5137fa44fa9f5e1833bb022d3eee to your computer and use it in GitHub Desktop.
mwe for saving an animation with pillow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from matplotlib.animation import FuncAnimation | |
numHeatMaps = 2 | |
measurements = [[(i + 1, j + 1, k * 100 + i * 10 + j) for i in range(5) for j in range(5)] for k in range(numHeatMaps)] | |
fig, ax = plt.subplots() | |
im = ax.imshow(measurements[0]) | |
def update(i): | |
im.set_data(measurements[i]) | |
ani = FuncAnimation(fig, update, frames=len(measurements)) | |
ani.save("test.gif", writer="pillow") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment