diff --git a/doc/source/whatsnew/v0.15.2.txt b/doc/source/whatsnew/v0.15.2.txt index eacccaa7cba92..f3f5cf41676da 100644 --- a/doc/source/whatsnew/v0.15.2.txt +++ b/doc/source/whatsnew/v0.15.2.txt @@ -99,6 +99,7 @@ Bug Fixes - Bug in ``BlockManager`` where setting values with different type would break block integrity (:issue:`8850`) - Bug in ``DatetimeIndex`` when using ``time`` object as key (:issue:`8667`) - Fix negative step support for label-based slices (:issue:`8753`) +- Fix: The font size was only set on x axis if vertical or the y axis if horizontal. (:issue:`8765`) Old behavior: diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index cb669b75e5c96..4f3aa4e8e4a9e 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -1051,13 +1051,15 @@ def _adorn_subplots(self): xticklabels = [labels.get(x, '') for x in ax.get_xticks()] ax.set_xticklabels(xticklabels) self._apply_axis_properties(ax.xaxis, rot=self.rot, - fontsize=self.fontsize) + fontsize=self.fontsize) + self._apply_axis_properties(ax.yaxis, fontsize=self.fontsize) elif self.orientation == 'horizontal': if self._need_to_set_index: yticklabels = [labels.get(y, '') for y in ax.get_yticks()] ax.set_yticklabels(yticklabels) self._apply_axis_properties(ax.yaxis, rot=self.rot, - fontsize=self.fontsize) + fontsize=self.fontsize) + self._apply_axis_properties(ax.xaxis, fontsize=self.fontsize) def _apply_axis_properties(self, axis, rot=None, fontsize=None): labels = axis.get_majorticklabels() + axis.get_minorticklabels() diff --git a/pandas/tseries/tests/test_plotting.py b/pandas/tseries/tests/test_plotting.py index 4a60cdbedae4d..c4e642ffe43b0 100644 --- a/pandas/tseries/tests/test_plotting.py +++ b/pandas/tseries/tests/test_plotting.py @@ -48,6 +48,14 @@ def test_ts_plot_with_tz(self): ts = Series([188.5, 328.25], index=index) _check_plot_works(ts.plot) + def test_fontsize_set_correctly(self): + # For issue #8765 + import matplotlib.pyplot as plt + df = DataFrame(np.random.randn(10, 9), index=range(10)) + ax = df.plot(fontsize=2) + for label in (ax.get_xticklabels() + ax.get_yticklabels()): + self.assertEqual(label.get_fontsize(), 2) + @slow def test_frame_inferred(self): # inferred freq