Repository: pandas-dev/pandas

Issue:
boxplot fontsize argument only works on x axis (and not on y axis)
#### Code Sample

```python
import pandas as pd
df = pd.DataFrame({"a": [0, 0, 0, 1, 1, 1], "b": [1, 2, 3, 4, 5, 6]})
df.boxplot("b", by="a", fontsize=20)
```
#### Problem description
The fontsize is only applied to the x axis and not to the y axis tick labels (see figure).
![boxplot](https://cloud.githubusercontent.com/assets/4377312/21848879/4522967a-d803-11e6-908a-becdc1739e40.png)

#### Expected Output
IMO this argument should change the font size of both axes tick labels. Side note: I've tried to use the new plot API, but I couldn't get the output to match the one shown above using `df.plot.box` (I couldn't figure out how to set the variable to plot in the first place - probably this only works on Series and not on DataFrames).

#### Output of ``pd.show_versions()``

<details>

    INSTALLED VERSIONS
    ------------------
    commit: None
    python: 3.5.2.final.0
    python-bits: 64
    OS: Darwin
    OS-release: 15.6.0
    machine: x86_64
    processor: i386
    byteorder: little
    LC_ALL: en_US.UTF-8
    LANG: en_US.UTF-8

    pandas: 0.18.1
    nose: 1.3.7
    pip: 8.1.2
    setuptools: 27.2.0
    Cython: 0.24.1
    numpy: 1.11.1
    scipy: 0.18.1
    statsmodels: 0.6.1
    xarray: None
    IPython: 5.1.0
    sphinx: 1.4.6
    patsy: 0.4.1
    dateutil: 2.5.3
    pytz: 2016.6.1
    blosc: None
    bottleneck: 1.1.0
    tables: 3.2.3.1
    numexpr: 2.6.1
    matplotlib: 1.5.3
    openpyxl: 2.3.2
    xlrd: 1.0.0
    xlwt: 1.1.2
    xlsxwriter: 0.9.3
    lxml: 3.6.4
    bs4: 4.5.1
    html5lib: None
    httplib2: None
    apiclient: None
    sqlalchemy: 1.0.13
    pymysql: None
    psycopg2: None
    jinja2: 2.8
    boto: 2.42.0
    pandas_datareader: None
</details>



Discussion:
Thanks for the report. I *think* you're right that fontsize should apply to all the ticklabels.
Interested in submitting a fix? The problem is roughly around [here](https://github.com/pandas-dev/pandas/blob/0fe491db358204544814aa2371fed4ea947532ab/pandas/tools/plotting.py#L2771). I don't think the fontsize should be set there. We should follow up with something like

```python
if kwds.get('fontsize') is not None:
    ax.tick_params(axis='both', labelsize=fontsize)
```

Not great that pandas is using fontsize, when it should be called labelsize, but oh well.

And as you noticed, the `.plot.box()` output isn't the same as `.boxplot` yet (backwards compatibility things).
Thanks @TomAugspurger! Alright, I'll try to submit a PR soon. We should think about creating another issue to rename `fontsize` to `labelsize`. And thanks for confirming that `plot.box` is not there yet.

Resolving patch:
diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py
--- 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


Test patch:
diff --git a/pandas/tests/plotting/test_boxplot_method.py b/pandas/tests/plotting/test_boxplot_method.py
--- 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'],