pydata/pandas — pull request #3073 by qwhelan (2013-03-17 05:51:24+00:00)
Title: Fix figsize issue when using matplotlib locally

This is a pretty minor issue, but I'm seeing the following when passing ```figsize=(20,10)``` when plotting a Series in the `ipython --pylab` environment:

![Series_figsize](https://f.cloud.github.com/assets/440095/267751/46f8b184-8ebd-11e2-8631-2131ce0421f6.png)

Everything's there - the window is just initialized to the wrong size. Without the `--pylab` flag and manually calling `plt.show()`, the window shows up as the default size (which is incorrect).

The issue appears to be that `plot_series()` will call `plt.gca()` before `figsize=` has been passed to `plt.figure()`. This initializes the window to the default size and it apparently isn't updated when redrawn.

What this patch does is use `plt.get_fignums()` to see if we have any existing figures. If so, we can call `plt.gca()` without automatically creating a figure and window at the default sizes.

The addition of `new_ax.right_axis = new_ax` is to accommodate Series plotted with `secondary_y=True` and thus getting `new_ax` as their `Axes`. It renders fine without it but a few tests expect `right_axis` to exist. This could be handled differently if this is inappropriate.

Finally, there's a test to check that `figsize=` is at least implemented on the figure. I don't know of a way to test this bug in a backend-independent way, so this only checks that we're not regressing to the pre-v0.10.0 state where `figsize=` was silently ignored by `plot_series()`.