How to update pcolormesh data & update plot?

Hello,
I have a pcolormesh() plot that I would like to update when a user presses a
key. Basically there are data files from 0..N and I want to update the plot
to the next frame when a user presses the 'right' arrow. I have the keypress
event working, I just don't know how to 'update' the data for the
pcolormesh.

I'm pretty new to matplotlib, so if anyone could help with this it would be
greatly appreciated!
Thanks! (Code snippet below)

def press(event):
  if event.key=='right':
    data2D = readDataFile() #updates data2D
                #update pcolormesh somehow??
    fig.canvas.draw()

#X,Y,data2D are initially set here...
fig = plt.figure()
fig.canvas.mpl_connect('key_press_event', press)
ax = fig.add_subplot(111)
plt.pcolormesh(X, Y, data2D)
plt.colorbar()

···


View this message in context: http://old.nabble.com/How-to-update-pcolormesh-data---update-plot--tp31913409p31913409.html
Sent from the matplotlib - users mailing list archive at Nabble.com.