title: masking part of a contourf plot in matplotlib
body: <p>I am trying to produce a filled contour plot in matplotlib using contourf. Data are missing in a jagged pattern near the bottom of the plot. The contour plot turns out blank not only where the original data are masked, but also in pockets where the contour algorithm cannot interpolate cleanly because there is an insufficient neighborhood of good data.</p>
  
  <p>I know how extend the dataset to produce plausible contours in these pockets. However, if I plot the extended data I get contour fill everywhere. I would like to mask out the regions where the original data were missing in black or white. </p>
  
  <p>On a previous thread I learned how to do this for an image by plotting the first image and then covering it up with another image that masks the bad areas. The analog would be the code snippet below but it doesn't work for a contour ... I can't get the bad_data imshow to cover up the extended contourf plot. Is it possible?</p>
  
  <p>Thanks,
  Eli</p>
  
  <pre><code>import matplotlib.pyplot as plt
  lev = [0.0,0.1,0.2,0.5,1.0,2.0,4.0,8.0,16.0,32.0]           
  norml = colors.BoundaryNorm(lev, 256)
  # this is the contour plot, using extended_data so that the contours are plausibly extended
  cs = plt.contourf(x,z,extended_data,levels = lev, cmap = cm.RdBu_r,norm = norml) 
  # now the attempt to cover it up -- but imshow will not cover up the original plot as it will with another image
  bad_data = np.ma.masked_where(~data.mask, data.mask, copy=True) 
  plt.imshow(bad_data, interpolation='nearest', aspect = 'auto', cmap=cm.gray)
  plt.show()
  </code></pre>