title: Using set_array with pyplot.pcolormesh ruins figure
body: <p>I have a xx and yy matrix created with <code>np.meshgrid</code> and a <code>grid</code> matrix of values created by operating on xx and yy. Then I plot the results using <code>graph = plt.pcolormesh(...</code> and get this: </p>
  
  <p><img src="https://i.stack.imgur.com/fsyif.png" alt="enter image description here"></p>
  
  <p>Then when I try to update the <code>grid</code> matrix in the plot using <code>graph.set_array(grid.ravel())</code> it causes the figure to be thwarted. </p>
  
  <p><img src="https://i.stack.imgur.com/UvJsN.png" alt="enter image description here"></p>
  
  <p>Does anyone know how to avoid this?</p>
  
  <p>Here is my full code if it helps: </p>
  
  <pre><code>from pylab import *
  import numpy as np
  import matplotlib.pyplot as plt
  from obspy import read
  
  dx = 5   # km
  dt = 5   # sec
  nx = 500
  ny = 500
  
  v = 3.5  # km/s
  p = 1/v
  
  t_min = np.int_(np.sqrt((nx*dx)**2 + (ny*dx)**2))/v
  nt = np.int_(t_min/dt)
  
  # Receiver position
  rx = 40 * dx
  ry = 40 * dx
  
  # Signal with ones
  signal = np.zeros(2*nt)
  signal[0:len(signal):len(signal)/10] = 1
  
  # Create grid:
  x_vector = np.arange(0, nx)*dx
  y_vector = np.arange(0, ny)*dx
  xx, yy = np.meshgrid(x_vector, y_vector)
  
  # Distance from source to grid point
  rr = np.int_(np.sqrt((xx - rx)**2 + (yy - ry)**2))
  
  # travel time grid
  tt_int = np.int_(rr/v)
  tt = rr/v
  
  # Read window of signal
  wlen = np.int_(t_min/dt)
  signal_window = signal[0:wlen]
  grid = signal_window[tt_int/dt]
  
  ax = plt.subplot(111)
  graph = plt.pcolormesh(xx, yy, grid, cmap=mpl.cm.Reds)
  plt.colorbar()
  plt.plot(rx, ry, 'rv', markersize=10)
  plt.xlabel('km')
  plt.ylabel('km')
  # plt.savefig('anitestnormal.png', bbox_inches='tight')
  
  signal_window = signal[wlen:wlen * 2]
  grid = signal_window[tt_int/dt]
  graph.set_array(grid.ravel())
  
  
  # plt.ion()
  plt.show()
  </code></pre>