title: Making image white space transparent, overlay onto imshow()
body: <p>I have a plot of spatial data  that I display with imshow().</p>
  
  <p>I need to be able to overlay the crystal lattice that produced the data. I have a png
  file of the lattice that loads as a black and white image.The parts of this image I want to
  overlay are the black lines that are the lattice and not see the white background between the lines.</p>
  
  <p>I'm thinking that I need to set the alphas for each background ( white ) pixel to transparent (0 ? ).</p>
  
  <p>I'm so new to this that I don't really know how to ask this question.</p>
  
  <p>EDIT:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  lattice = plt.imread('path')
  im = plt.imshow(data[0,:,:],vmin=v_min,vmax=v_max,extent=(0,32,0,32),interpolation='nearest',cmap='jet')
  
  im2 = plt.imshow(lattice,extent=(0,32,0,32),cmap='gray')
  
  #thinking of making a mask for the white background
  mask = np.ma.masked_where( lattice &lt; 1,lattice ) #confusion here b/c even tho theimage is gray scale in8, 0-255, the numpy array lattice 0-1.0 floats...?
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/zCTTi.jpg" alt="enter image description here"></p>