From a4c0d01f5c6d9b2012300e4c832c0d9f2dff324e Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Thu, 19 Jan 2017 08:45:03 +0100 Subject: [PATCH 1/3] Apply fontsize to both x- and y-axis tick labels --- pandas/tools/plotting.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index bd9933b12b580..012d67d29cc3f 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -2768,10 +2768,12 @@ def plot_group(keys, values, ax): keys = [pprint_thing(x) for x in keys] values = [remove_na(v) for v in values] bp = ax.boxplot(values, **kwds) + if fontsize is not None: + ax.tick_params(axis='both', labelsize=fontsize) if kwds.get('vert', 1): - ax.set_xticklabels(keys, rotation=rot, fontsize=fontsize) + ax.set_xticklabels(keys, rotation=rot) else: - ax.set_yticklabels(keys, rotation=rot, fontsize=fontsize) + ax.set_yticklabels(keys, rotation=rot) maybe_color_bp(bp) # Return axes in multiplot case, maybe revisit later # 985 From 74992e089c2e6362e8e39f3c3c47854a82d8c989 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Thu, 19 Jan 2017 10:24:26 +0100 Subject: [PATCH 2/3] Add tests --- pandas/tests/plotting/test_boxplot_method.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pandas/tests/plotting/test_boxplot_method.py b/pandas/tests/plotting/test_boxplot_method.py index f76cdb70c0240..289d48ba6d4cc 100644 --- a/pandas/tests/plotting/test_boxplot_method.py +++ b/pandas/tests/plotting/test_boxplot_method.py @@ -158,6 +158,11 @@ def test_boxplot_empty_column(self): df.loc[:, 0] = np.nan _check_plot_works(df.boxplot, return_type='axes') + def test_fontsize(self): + df = DataFrame({"a": [1, 2, 3, 4, 5, 6]}) + self._check_ticks_props(df.boxplot("a", fontsize=16), + xlabelsize=16, ylabelsize=16) + @tm.mplskip class TestDataFrameGroupByPlots(TestPlotBase): @@ -369,6 +374,11 @@ def test_grouped_box_multiple_axes(self): with tm.assert_produces_warning(UserWarning): axes = df.groupby('classroom').boxplot(ax=axes) + def test_fontsize(self): + df = DataFrame({"a": [1, 2, 3, 4, 5, 6], "b": [0, 0, 0, 1, 1, 1]}) + self._check_ticks_props(df.boxplot("a", by="b", fontsize=16), + xlabelsize=16, ylabelsize=16) + if __name__ == '__main__': nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'], From b2258054b1a219e2014175b495ab5a4897191417 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Fri, 20 Jan 2017 11:56:18 +0100 Subject: [PATCH 3/3] Add note in whatsnew --- doc/source/whatsnew/v0.20.0.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/source/whatsnew/v0.20.0.txt b/doc/source/whatsnew/v0.20.0.txt index f3d60fa8cc05f..798151971363e 100644 --- a/doc/source/whatsnew/v0.20.0.txt +++ b/doc/source/whatsnew/v0.20.0.txt @@ -439,6 +439,9 @@ Bug Fixes - Bug in ``pd.read_csv()`` for the C engine where ``usecols`` were being indexed incorrectly with ``parse_dates`` (:issue:`14792`) - Bug in ``Series.dt.round`` inconsistent behaviour on NAT's with different arguments (:issue:`14940`) + - Bug in ``.read_json()`` for Python 2 where ``lines=True`` and contents contain non-ascii unicode characters (:issue:`15132`) - Bug in ``pd.read_csv()`` with ``float_precision='round_trip'`` which caused a segfault when a text entry is parsed (:issue:`15140`) + +- Bug in ``DataFrame.boxplot`` where ``fontsize`` was not applied to the tick labels on both axes (:issue:`15108`)