ENH/VIS: Plotting DataFrame/Series with matplotlib.table
State: closed

closes #4803

Related to #4803, I prepared some codes to add a `matplotlib.Table` to `DataFrame` and `Series` plot using `table` keyword. `table` can take followings as an input:
- `False`: Do nothing (default).
- `True`: Draw a table using the data called `plot` method. Data will be transposed to meet the matplotlib's default layout.
- `DataFrame` or `Series`: Draw matplotlib.table using the passed data. The data will be drawn as displayed in print method (not transposed automatically).

Also, helper function `pandas.tools.plotting.table` is added to create a table from `DataFrame` and `Series`, and add it to the `matplotlib.Axes`.

_Example:_

```
fig, axes = plt.subplots(1, 3, figsize=(14, 4))
plt.subplots_adjust(top=0.97, bottom=0.2, left=0.05, right=0.97, hspace=0.2)

df.plot(ax=axes[0], table=True, legend=False)
axes[0].get_xaxis().set_visible(False)

df.plot(ax=axes[1], table=np.round(df.T, 2), legend=False)
axes[1].get_xaxis().set_visible(False)

df.plot(ax=axes[2], legend=False)

import pandas.tools.plotting as plotting
plotting.table(axes[2], np.round(df.describe(), 2),
               loc='upper right', colWidths=[0.2, 0.2, 0.2])

plt.show()
```

_Outputs:_
![figure_table](https://f.cloud.github.com/assets/1696302/2448693/7d4028e6-aea9-11e3-9a2e-f36087638dac.png)


Labels:
name: Enhancement
name: Visualization
description: plotting

Comments:
@TomAugspurger pls have a look at this when you get a chance

pls add the release note to v0.14.0 as well

@sinhrks can you rebase this?

also, can you add an example in plotting.rst using this?

When you put the example in `plotting.rst`, maybe note that you can get the table from the `axes` object with `ax.tables`. That way they can easily tweak the formatting.

I don't think that we should do much try to automatically format the tables well. I'm guessing this is something that doesn't have a great general solution.

Let me know when you get those changes and rebased and I'll merge. Thanks and sorry for missing this when you submitted the PR.

@TomAugspurger Thanks for your review and comments.

I've added examples to `plotting.rst` and modified based on your comments except keyword name. As answered in above, these are defined in MPL so I think it is better to use as it is, clarifying these are from MPL. 

Agreed about sticking with the MPL keywords. Good call. Thanks @sinhrks!

hmm....the first example in the docs is not printing the table
is this a version issue? 2.7 builds with matplotlib 1.1.1 (is this too old)?

http://pandas-docs.github.io/pandas-docs-travis/visualization.html#plotting-with-table

It actually may be a figsize thing. It looks like it is plotting the table but it gets cut off.

I'm looking into this btw.

@TomAugspurger when you update can you add a link in v0.14.0 to the docs for table plotting? thanks

I'm not able to reproduce this locally, so I haven't found out what's causing the problem. The good news is that it's not mol 1.1.1 related. I was unable to reproduce it with that also.

These are built by travis right? So there's no way to get access to the machine as its building?

I think you could in your branch push something up with the flag to turn doc builds on and the n have it dump whatever output you need (e.g. just use print statements)