import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.path as path import matplotlib.animation as animation
# Fixing random state for reproducibility np.random.seed(19680801)
# histogram our data with numpy data = np.random.randn(1000) n, bins = np.histogram(data, 100)
# get the corners of the rectangles for the histogram left = np.array(bins[:-1]) right = np.array(bins[1:]) bottom = np.zeros(len(left)) top = bottom + n nrects = len(left)
defanimate(i): # simulate new data coming in data = np.random.randn(1000) n, bins = np.histogram(data, 100) top = bottom + n verts[1::5, 1] = top verts[2::5, 1] = top return [patch, ]