title: matplotlib: adding second axes() with transparent background?
body: <p>Define data</p>
  
  <pre><code>x = np.linspace(0,2*np.pi,100)
  y = 2*np.sin(x)
  </code></pre>
  
  <p>Plot</p>
  
  <pre><code>fig = plt.figure()
  ax = plt.axes()
  fig.add_subplot(ax)
  ax.plot(x,y)
  </code></pre>
  
  <p>Add second axis</p>
  
  <pre><code>newax = plt.axes(axisbg='none')
  </code></pre>
  
  <p>Gives me <code>ValueError: Unknown element o</code>, even though it does the same thing as what I am about to describe. I can also see that this works (no error) to do the same thing:</p>
  
  <pre><code>newax = plt.axes()
  fig.add_subplot(newax)
  newax.set_axis_bgcolor('none')
  </code></pre>
  
  <p>However, it turns the background color of the original figure "gray" (or whatever the figure background is)? I don't understand, as I thought this would make newax transparent except for the axes and box around the figure. Even if I switch the order, same thing:</p>
  
  <pre><code>plt.close('all')
  fig = plt.figure()
  newax = plt.axes()
  fig.add_subplot(newax)
  newax.set_axis_bgcolor('none')
  ax = plt.axes()
  fig.add_subplot(ax)
  ax.plot(x,y)
  </code></pre>
  
  <p>This is surprising because I thought the background of one would be overlaid on the other, but in either case it is the newax background that appears to be visible (or at least this is the color I see).</p>
  
  <p>What is going on here?</p>