We're updating the default styles for Matplotlib 2.0

Learn what to expect in the new updates


Previous topic

animation example code: rain.py

Next topic

animation example code: simple_3danim.py

This Page

animation example code: random_data.pyΒΆ

[source code]

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

fig, ax = plt.subplots()
line, = ax.plot(np.random.rand(10))
ax.set_ylim(0, 1)

def update(data):
    return line,

def data_gen():
    while True:
        yield np.random.rand(10)

ani = animation.FuncAnimation(fig, update, data_gen, interval=100)

Keywords: python, matplotlib, pylab, example, codex (see Search examples)