Created
June 30, 2017 13:06
-
-
Save vaclavcadek/66c9c61a1fac30150514a665c4bcb5dc to your computer and use it in GitHub Desktop.
How to generate animation using numpy arrays.
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
from matplotlib.animation import FuncAnimation | |
import matplotlib.pyplot as plt | |
import numpy as np | |
fig, ax = plt.subplots(figsize=(5, 8)) | |
def update(i): | |
im_normed = np.random.random((64, 64)) | |
ax.imshow(im_normed) | |
ax.set_title("Angle: {}*pi/10".format(i), fontsize=20) | |
ax.set_axis_off() | |
anim = FuncAnimation(fig, update, frames=np.arange(0, 20), interval=50) | |
anim.save('colour_rotation.gif', dpi=80, writer='imagemagick') | |
plt.close() |
I got this code working in a notebook using a markdown cell with the following code,
![SegmentLocal](colour_rotation.gif "colour_rotation")
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to embed this in notebook?