I would like to draw a contour plot on top of an image and such that any values of the countour plot < x are made transparent.
Here is what I am doing at the moment to handle the overplotting:
from matplotlib import pyplot as plt
fig = plt.figure()
axes = fig.add_subplot(111)
contour = plt.imshow(contour_data, extent=contour_extent,cmap=contour_cmap, origin=‘lower’, zorder=10)
im = plt.imshow(im_data, extent=im_extent, cmap=im_cmap, origin=‘lower’, zorder=1)
Any suggestions? One thing I thought about doing is converting im_data and contour_data from grayscale to RGBA, and setting the alpha channel to 0 for all data with value less than x, but I was hoping there might be a more straight-forward way to handle this.