title: How to make axes transparent in matplotlib?
body: <p>So I have the following example that plots a figure and an inset:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  fig = plt.figure()
  
  ax1 = fig.add_subplot(1, 1, 1)
  x = np.arange(100).reshape((10, 10))
  ax1.imshow(x)
  
  ax2 = fig.add_axes([0.5, 0.5, 0.3, 0.3])
  t = np.arange(0, 1, 0.01)
  s = np.sin(t)
  ax2.plot(t, s, linewidth=2)
  </code></pre>
  
  <p>This produces the following figure:
  <a href="https://i.stack.imgur.com/RgmK9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RgmK9.png" alt="enter image description here"></a></p>
  
  <p>What I would like to have thought is the inset to be a little bit <strong>transparent</strong> (say alpha=0.5). I want something along the lines of what they do in the documentation for the legends in the matplotlib documentation:</p>
  
  <p><a href="https://i.stack.imgur.com/HJ8Gw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HJ8Gw.png" alt="enter image description here"></a></p>
  
  <p><a href="http://matplotlib.org/users/recipes.html#transparent-fancy-legends" rel="noreferrer">http://matplotlib.org/users/recipes.html#transparent-fancy-legends</a></p>
  
  <p>Is that possible? does anyone know how to do that?</p>
  
  <p>All the best,</p>
  
  <p>P.D. As mentioned in the comments the answer to this questions can be derived from the answer to the linked question. It is just a little bit different conceptually (figure vs axis) and far more straightforward here IMO. </p>