title: matplotlib savefig() size control
body: <p>I wrote a function that took a dataframe generated from Pandas and produce a heatmap:</p>
  
  <pre><code>def drawHeatMap(df, city, province, collector, classtype, color, titleposy):
      try:
          thePlot = pl.matshow(df.values, cmap='PuBuGn')
          pl.colorbar(thePlot, orientation='vertical')
          aTitle = (classtype + ' Composition Changes Over Time in ' + city + 
                  ', ' + province + '\n' + collector + ' collector. ' + 'rs100')
          pl.title(aTitle, x=0.5, y=titleposy, style='oblique', weight='bold')
          pl.xlabel('Collection Time')
          pl.xticks(range(len(df.columns)), df.columns, rotation=90)
          pl.yticks(range(len(df.index)), df.index)
          fileName = (classtype + '-' + city + '-' 
                  + province + '-' + collector + '.png')
          pl.savefig(fileName)
      except ZeroDivisionError:
          errorMessage = ('No Data Avaiable for ' + city + ', ' + province + 
                  ' with ' + collector + ' collector.')
          print errorMessage
  </code></pre>
  
  <p>The problem I am having is, <code>savefig()</code> would save figures with the axis and graphics trimmed. I have to use <code>show()</code>, maximize the graph and manually save the figure with the GUI button myself. </p>
  
  <p>How can I fix my function so <code>savefig()</code> would save the graphs properly? I tried to put a line like this before <code>pl.savefig()</code> to control my figure:</p>
  
  <pre><code>       pl.figure(figsize=....) 
  </code></pre>
  
  <p>but I end up producing some empty graphs. What is the proper way to write a matplotlib function that give me full control on saving the figure?</p>
  
  <p><strong>Updated with Example of a problem figure:</strong>
  <img src="https://i.stack.imgur.com/j55qo.png" alt="enter image description here"></p>