Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

BUG: grouped hist and scatter use old figsize default #7394

Merged
merged 1 commit into from Jul 1, 2014
Jump to file or symbol
Failed to load files and symbols.
+22 −21
Split
View
@@ -175,6 +175,7 @@ Bug Fixes
- Bug in ``value_counts`` where ``NaT`` did not qualify as missing (``NaN``) (:issue:`7423`)
+- Bug in grouped ``hist`` and ``scatter`` plots use old ``figsize`` default (:issue:`7394`)
- Bug in ``Panel.apply`` with a multi-index as an axis (:issue:`7469`)
@@ -609,16 +609,16 @@ def test_hist_layout_with_by(self):
df = self.hist_df
axes = _check_plot_works(df.height.hist, by=df.gender, layout=(2, 1))
- self._check_axes_shape(axes, axes_num=2, layout=(2, 1), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=2, layout=(2, 1))
axes = _check_plot_works(df.height.hist, by=df.category, layout=(4, 1))
- self._check_axes_shape(axes, axes_num=4, layout=(4, 1), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=4, layout=(4, 1))
axes = _check_plot_works(df.height.hist, by=df.classroom, layout=(2, 2))
- self._check_axes_shape(axes, axes_num=3, layout=(2, 2), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=3, layout=(2, 2))
- axes = _check_plot_works(df.height.hist, by=df.category, layout=(4, 2))
- self._check_axes_shape(axes, axes_num=4, layout=(4, 2), figsize=(10, 5))
+ axes = _check_plot_works(df.height.hist, by=df.category, layout=(4, 2), figsize=(12, 7))
+ self._check_axes_shape(axes, axes_num=4, layout=(4, 2), figsize=(12, 7))
@slow
def test_hist_no_overlap(self):
@@ -2255,11 +2255,11 @@ def test_grouped_hist(self):
df = DataFrame(randn(500, 2), columns=['A', 'B'])
df['C'] = np.random.randint(0, 4, 500)
axes = plotting.grouped_hist(df.A, by=df.C)
- self._check_axes_shape(axes, axes_num=4, layout=(2, 2), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=4, layout=(2, 2))
tm.close()
axes = df.hist(by=df.C)
- self._check_axes_shape(axes, axes_num=4, layout=(2, 2), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=4, layout=(2, 2))
tm.close()
# make sure kwargs to hist are handled
@@ -2281,6 +2281,9 @@ def test_grouped_hist(self):
with tm.assertRaises(AttributeError):
plotting.grouped_hist(df.A, by=df.C, foo='bar')
+ with tm.assert_produces_warning(FutureWarning):
+ df.hist(by='C', figsize='default')
+
@slow
def test_grouped_box_return_type(self):
df = self.hist_df
@@ -2366,29 +2369,28 @@ def test_grouped_hist_layout(self):
layout=(1, 3))
axes = _check_plot_works(df.hist, column='height', by=df.gender, layout=(2, 1))
- self._check_axes_shape(axes, axes_num=2, layout=(2, 1), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=2, layout=(2, 1))
axes = _check_plot_works(df.hist, column='height', by=df.category, layout=(4, 1))
- self._check_axes_shape(axes, axes_num=4, layout=(4, 1), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=4, layout=(4, 1))
axes = _check_plot_works(df.hist, column='height', by=df.category,
layout=(4, 2), figsize=(12, 8))
-
self._check_axes_shape(axes, axes_num=4, layout=(4, 2), figsize=(12, 8))
# GH 6769
axes = _check_plot_works(df.hist, column='height', by='classroom', layout=(2, 2))
- self._check_axes_shape(axes, axes_num=3, layout=(2, 2), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=3, layout=(2, 2))
# without column
axes = _check_plot_works(df.hist, by='classroom')
- self._check_axes_shape(axes, axes_num=3, layout=(2, 2), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=3, layout=(2, 2))
axes = _check_plot_works(df.hist, by='gender', layout=(3, 5))
- self._check_axes_shape(axes, axes_num=2, layout=(3, 5), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=2, layout=(3, 5))
axes = _check_plot_works(df.hist, column=['height', 'weight', 'category'])
- self._check_axes_shape(axes, axes_num=3, layout=(2, 2), figsize=(10, 5))
+ self._check_axes_shape(axes, axes_num=3, layout=(2, 2))
@slow
def test_axis_share_x(self):
View
@@ -2734,20 +2734,18 @@ def _grouped_plot(plotf, data, column=None, by=None, numeric_only=True,
rot=0, ax=None, **kwargs):
from pandas import DataFrame
- # allow to specify mpl default with 'default'
- if figsize is None or figsize == 'default':
- figsize = (10, 5) # our default
+ if figsize == 'default':
+ # allowed to specify mpl default with 'default'
+ warnings.warn("figsize='default' is deprecated. Specify figure"
+ "size by tuple instead", FutureWarning)
+ figsize = None
grouped = data.groupby(by)
if column is not None:
grouped = grouped[column]
naxes = len(grouped)
nrows, ncols = _get_layout(naxes, layout=layout)
- if figsize is None:
- # our favorite default beating matplotlib's idea of the
- # default size
- figsize = (10, 5)
fig, axes = _subplots(nrows=nrows, ncols=ncols, naxes=naxes,
figsize=figsize, sharex=sharex, sharey=sharey, ax=ax)