title: Matplotlib Pandas: Subplots of 3 columns and each column is a subplot of 3 rows
body: <p>I have the following pandas dataframe:</p>
  <p><a href="https://i.stack.imgur.com/mqaE0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mqaE0.png" alt="enter image description here" /></a></p>
  <p>My goal is to plot the dataframe in 3 columns, where each column is a 'section'. And, at the same time, each plot is a subplot of 3 lines and 1 column, where one line is 'Col1 [%]', second line is 'Col 2' and last is 'Col 3 [%]'</p>
  <p>If I set <strong>subplots=True</strong>, I obtain the following plot:</p>
  <p><a href="https://i.stack.imgur.com/jFYet.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jFYet.png" alt="enter image description here" /></a></p>
  <p>Else, with <strong>subplots=False</strong>, I obtain:</p>
  <p><a href="https://i.stack.imgur.com/1TLC5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1TLC5.png" alt="enter image description here" /></a></p>
  <p><strong>But what I need is to obtain the 3 columns, but where each column plot will be equals to the graph with suplots=True. How can I do that?</strong></p>
  <p>Thanks a lot in advance!</p>
  <p>My code:</p>
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib.ticker as ticker
  
  # DATA
  dfplot = pd.DataFrame(columns = ['section', 'description', 'Col1 [%]', 'Col 2', 'Col 3 [%]'])
  dfplot['description'] = ['d1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9']
  dfplot['section'] = [1, 1, 1, 2, 2, 2, 3, 3, 3]
  dfplot['Col1 [%]'] = [82, 89, 86, 100, 100, 99, 16, 16, 16]
  dfplot['Col 2'] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
  dfplot['Col 3 [%]'] = [99.19, 98.7, 99.36, 99.9, 99.93, 99.5, 97.66, 97.84, 97.66]
  dfplot = dfplot.groupby(['section', 'description'], as_index=True).last()
  
  
  # PLOT -------------
  
  # Set levels to group labels in ax X
  cols = list(set(l_columns_values))
  dfplot.index.set_levels([cols, l_strains], level=[0,1])
  
  fig, axes = plt.subplots(nrows=1, ncols=len(cols), 
                           sharey=True, sharex=True, 
                           figsize=(14 / 2.54, 10 / 2.54) # width, height
                          )  
  
  for i, col in enumerate(list(set(l_contigs))):
      ax = axes[i] #, j]
      
      print(ax)
      print(&quot;i= {}, col= {}&quot;.format(i, col))
  
      dfplot.loc[col].plot.area(ax=ax,
                                #layout=(3, 1),
                                stacked=True, 
                                subplots=True, ## &lt;--     
                                grid=True,
                                table=False,
                                sharex=True,
                                sharey=True,
                                figsize=(20,7),
                                fontsize=12,
                                #xticks = np.arange(0, len(cols)+1, 1)
                               )
      #ax[i].set_ylim(-1,100)
      ax.set_xlabel(col, weight='bold', fontsize=20)
      ax.set_axisbelow(True)    
  
      for tick in ax.get_xticklabels():
          tick.set_rotation(90)
  
  # make the ticklines invisible
  ax.tick_params(axis=u'both', which=u'both', length=0)
  plt.tight_layout()
  
  # remove spacing in between
  fig.subplots_adjust(wspace=0.5)  # space between plots
  
  # legend
  plt.legend(loc='upper right')
  
  # Add title
  fig.suptitle('My title')
  
  plt.show()    
  </code></pre>