""" an easy approach of updating a contour plot """

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

plt.ion()                                 # interactive mode of matplotlib


ax = plt.subplot(111, xlabel="some nice x label")

for i in xrange(10):
    x = np.random.uniform(size=(20, 20))  # get some random data
    ax.contour(x)
    plt.draw()                            # redraw current figure
    time.sleep(1)                         # wait for one second

    # delete all collections (including lines of contour)    
    ax.collections = []

plt.ioff()
plt.show()
