title: Matplotlib - place pie charts in a grid
body: <p>I am trying to organize pie charts in a grid, with another column on the left in which I write some relevant data on the pie charts of the specific row. Right now my code is:</p>
  
  <pre><code>data = [[0.3,0.3,0.3,0.1],[0.2,0.2,0.2,0.4],[0.1,0.1,0.4,0.4]]
  
  
  def main():
      createPieCharts(data)
      return 0
  
  
  def createPieCharts(data,piecharts_fname="piecharts"):
      """ """
      import datetime
      from matplotlib.backends.backend_pdf import PdfPages
      import matplotlib.pyplot as plt
      areas = ['Arava','Lotz','Paran','Ramon']
      thresholds = [0.0,0.01,0.02]
      num_columns = len(areas)
      num_rows    = len(thresholds)
      with PdfPages(piecharts_fname+'.pdf') as pdf:
          fig, ax = plt.subplots(num_rows,num_columns)
  #            fig.suptitle('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5})
          labels = ['Frogs', 'Hogs', 'Dogs', 'Logs']
          for i,threshold in enumerate(thresholds):
              fracs = data[i]
              for j,area in enumerate(areas):
                  ax[i,j].set_title(area)
                  ax[i,j].pie(fracs, labels=labels,
                              autopct='%1.1f%%', shadow=True, startangle=90)
                  ax[i,j].set_aspect('equal')
          plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
          pdf.savefig(fig)
          plt.close()
          # Adding metadata for PDF file
          d = pdf.infodict()
          d['Title'] = 'Pie charts'
          d['CreationDate'] = datetime.datetime.today()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>And the result looks like this
  <a href="https://i.stack.imgur.com/Ipj3A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ipj3A.png" alt="enter image description here"></a>
  While I would like it to have another column on the left like in this example - 
  <a href="https://i.stack.imgur.com/uLWf8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uLWf8.png" alt="enter image description here"></a></p>
  
  <p>What is the smart way to do it?</p>