Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import matplotlib.animation as animation
- import random
- def animate(frameno):
- x = random.randint(-200, 200)
- n = [x, -x]
- for rect, h in zip(rects, n):
- rect.set_height(h)
- return rects
- # --- init ---
- fig, ax = plt.subplots()
- rects = plt.bar([0,1], [0,0], width=1)
- plt.ylim([-200, 200])
- ani = animation.FuncAnimation(fig, animate, blit=True,
- interval=100, frames=100, repeat=False)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement