title: Matplotlib plotting subplots to existing figure
body: <p>I'm wondering if there's an equivalent function to</p>
  
  <pre><code>fig, axarr = plt.subplots(3, 2, sharex='col', sharey='row')
  </code></pre>
  
  <p>where only the axes array is generated for an existing figure, instead of creating a new figure object. I basically need to create a matplotlib window, populate it, and update it when a button has been pressed. I would like to use the <code>subplots</code> method as it allows sharing axes, but it forces the creation of a new figure object, which would open a new window.</p>
  
  <p>My current code looks like this:</p>
  
  <pre><code>fig = plt.figure()
  
  # When button is pressed
  fig.clear()
  for i in range(6):
      ax = fig.add_subplot(3, 2, i+1)
      ax.plot(x, y)
  plt.draw()
  </code></pre>
  
  <p>And I'd like to do something like</p>
  
  <pre><code>fig, axarr = plt.subplots(3, 2, sharex='col', sharey='row')
  
  # When button is pressed
  fig.clear()
  axarr = fig.subplots(3, 2, sharex='col', sharey='row')
  for i in range(3):
      for j in range(2):
          ax = axarr[i][j]
          ax.plot(x, y)
  plt.draw()
  </code></pre>
  
  <p>Alternatively, is there a way to directly work with the matplotlib windows? I could plot the new figure object into the existing window if that is an option as well.</p>
  
  <p>I am using the PySide backend if that makes any difference. Thanks.</p>