Format a table that was added to a plot using pandas.DataFrame.plot
<p>I'm producing a bar graph with a table using pandas.DataFrame.plot.</p>

<p>Is there a way to format the table size and/or font size in the table to make it more readable?</p>

<p>My DataFrame (dfexe):</p>

<pre><code>City    State   Waterfalls  Lakes   Rivers
LA  CA  2   3   1
SF  CA  4   9   0
Dallas  TX  5   6   0
</code></pre>

<p>Create a bar chart with a table:</p>

<pre><code>myplot = dfex.plot(x=['City','State'],kind='bar',stacked='True',table=True)
myplot.axes.get_xaxis().set_visible(False)
</code></pre>

<p>Output:
<a href="http://i.stack.imgur.com/qNGUx.png" rel="nofollow"><img src="http://i.stack.imgur.com/qNGUx.png" alt="enter image description here"></a></p>

<p>Here is an answer.</p>

<pre><code># Test data
dfex = DataFrame({'City': ['LA', 'SF', 'Dallas'],
 'Lakes': [3, 9, 6],
 'Rivers': [1, 0, 0],
 'State': ['CA', 'CA', 'TX'],
 'Waterfalls': [2, 4, 5]})

myplot = dfex.plot(x=['City','State'],kind='bar',stacked='True',table=True)
myplot.axes.get_xaxis().set_visible(False)
# Getting the table created by pandas and matplotlib
table = myplot.tables[0]
# Setting the font size
table.set_fontsize(12)
# Rescaling the rows to be more readable
table.scale(1,2)
</code></pre>

<p><a href="http://i.stack.imgur.com/gigvi.png" rel="nofollow"><img src="http://i.stack.imgur.com/gigvi.png" alt="enter image description here"></a></p>

<p>Note: Check also <a href="http://stackoverflow.com/questions/15514005/how-to-change-the-tables-fontsize-with-matplotlib-pyplot">this</a> answer for more information. </p>

python pandas matplotlib