title: Plotting multiple plots in a grid with pandas and pyplot
body: <p>I have a list with pandas dataframes each comprising a timeseries.</p>
  
  <p>When I try to plot them in a grid I get them all appearing in the same plot instead (i.e. not in a grid each one occupying a cell of the grid).  My code is here:</p>
  
  <pre><code>for i in range(len(building_ids)): # building_ids is the list containing the dataframes/timeseries)
      ax = fig.add_subplot(nrows, ncols, i+1)
      building_id_dfs[i].plot(label = str(building_ids[i]))
      plt.legend()
  </code></pre>
  
  <p>This returns the following plot:</p>
  
  <p><a href="https://i.stack.imgur.com/rYVTv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rYVTv.png" alt="enter image description here"></a></p>
  
  <p>Another attempt also fails:</p>
  
  <pre><code>fig, axs = plt.subplots(3, 4)
  for i in range(nrows):
      for j in range(ncols):
  
          axs[i+1, j+1].plot(building_id_dfs[i + j].index,  building_id_dfs[i + j], label = str(building_ids[i + j]))
      plt.legend()
  
  No handles with labels found to put in legend.
  
  ---------------------------------------------------------------------------
  IndexError                                Traceback (most recent call last)
  &lt;ipython-input-93-2cc113304bb7&gt; in &lt;module&gt;
        3     for j in range(ncols):
        4 
  ----&gt; 5         axs[i+1, j+1].plot(building_id_dfs[i + j].index,  building_id_dfs[i + j], label = str(building_ids[i + j]))
        6     plt.legend()
  
  IndexError: index 3 is out of bounds for axis 0 with size 3
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/JaaME.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JaaME.png" alt="enter image description here"></a></p>
  
  <p>How can I solve this issue?</p>