title: Matplotlib: Overplot a line above another axes panel
body: <p>There are two axes panels, with a small one (in gray color) inside a big one (white color).</p>
  
  <p>With the following code, I am expecting the blue line to be on top of the gray small axes panel, because the blue line is set to have a ridiculously high <code>zorder</code>.  But it turns out not to be the case.</p>
  
  <p>Changing the <code>zorder</code> of the patch of the small panel has no effect.</p>
  
  <p>If I set the background of the small panel to be transparent (or make it invisible), then the blue line will appear unblocked, but this solution is not satisfactory, because there may be situations in which <strong>IT IS REQUIRED</strong> to keep the background of the small panel to be opaque.</p>
  
  <p>Or maybe such a requirement is not achievable in a simple way, if by implementation the <code>zorder</code> of lines are only meaningful within the same axes?</p>
  
  <pre><code>f = figure()
  
  ax1 = f.add_axes([0.1,0.1,0.8,0.8], zorder=1)
  ax2 = f.add_axes([0.3,0.2,0.5,0.4], zorder=2)
  ax2.patch.set_facecolor('gray')
  ax2.patch.set_zorder(-9999999)
  ax1.plot([0,1], [0,1], zorder=99999999, color='blue')
  ax2.plot([0,1], [0,3], zorder=-99999, color='red')
  
  # New Edit:
  # To make the problem more to the point, what if someone
  # also wants the background of the big panel to be green
  # (with the following command)?  See the second figure.
  ax1.patch.set_facecolor('green')
  # This seems to mean that the small panel really has to
  # somehow "insert" into the z-space between the big panel
  # and the blue line.
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/PKLZW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PKLZW.png" alt="Figure generated by the following code"></a>
  <a href="https://i.stack.imgur.com/mzGFv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mzGFv.png" alt="New image"></a></p>