Last active
May 22, 2016 19:29
-
-
Save dloranc/18a6001503fa3b8ff215bcb7956526e5 to your computer and use it in GitHub Desktop.
Example of subplot with colspan
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 | |
import matplotlib.animation as animation | |
from random import random | |
fig = plt.figure() | |
subplots = [] | |
for i in xrange(6): | |
for j in xrange(6): | |
subplot = plt.subplot2grid((7, 6), (i, j)) | |
subplots.append(subplot) | |
subplot = plt.subplot2grid((7, 6), (6, 0), colspan=6) | |
subplots.append(subplot) | |
x = [] | |
y = [] | |
def animate(i): | |
x.append(i) | |
y.append(random()) | |
for i in xrange(len(subplots)): | |
subplots[i].plot(x, y, 'r.-') | |
ani = animation.FuncAnimation(fig, animate, interval=1) | |
print '#1 Backend:', plt.get_backend() | |
# See, if code below doesn't works: | |
# http://stackoverflow.com/questions/12439588/how-to-maximize-a-plt-show-window-using-python | |
mng = plt.get_current_fig_manager() | |
mng.resize(*mng.window.maxsize()) | |
# create video | |
# anim.save('animation.mp4', fps=25, writer="avconv", codec="libx264") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment