Skip to content

Instantly share code, notes, and snippets.

@dloranc
Last active May 22, 2016 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dloranc/17c4d51e7eef03b519f718377813ee7d to your computer and use it in GitHub Desktop.
Save dloranc/17c4d51e7eef03b519f718377813ee7d to your computer and use it in GitHub Desktop.
Plot many subplots with "live" data in maximized window
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from random import random
fig = plt.figure()
subplots = []
for i in xrange(36):
subplot = fig.add_subplot(6, 6, i)
subplots.append(subplot)
x = []
y = []
def animate(i):
x.append(i)
y.append(random())
for i in xrange(36):
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