title: Remove empty sub plots in matplotlib figure
body: <p>How can I determine whether a subplot (<code>AxesSubplot</code>) is empty or not? I would like to deactivate empty axes of empty subplots and remove completely empty rows.</p>
  
  <p>For instance, in this figure only two subplots are filled and the remaining subplots are empty.</p>
  
  <pre><code>import matplotlib.pyplot as plt
  
  # create figure wit 3 rows and 7 cols; don't squeeze is it one list
  fig, axes = plt.subplots(3, 7, squeeze=False)
  x = [1,2]
  y = [3,4]
  
  # plot stuff only in two SubAxes; other axes are empty
  axes[0][1].plot(x, y)
  axes[1][2].plot(x, y)
  
  # save figure
  plt.savefig('image.png')
  </code></pre>
  
  <p>Note: It is mandatory to set <code>squeeze</code> to <code>False</code>.</p>
  
  <p>Basically I want a sparse figure. Some subplots in rows can be empty, but they should be deactivated (no axes must be visible). Completely empty rows must be removed and must not be set to invisible.</p>