Repository: pandas-dev/pandas-stubs (language: python)

Issue:
`labelsize` arguments need fixes
              Oh , the upstream docs of this, and other label size usages, will need to be updated to accept `float | str | None` (See the [matplotlib docs](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.tick_params.html)). I typed them as `int | None` here for now because they need to be fixed everywhere in pandas-stubs, not just this file. We can do that in a separate PR.

_Originally posted by @hamdanal in https://github.com/pandas-dev/pandas-stubs/pull/848#discussion_r1451472602_
            
Probably needs fixes in the stubs and in pandas docs


Discussion / hints:

Fix patch:
diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi
index 21974c42..3f643f57 100644
--- a/pandas-stubs/core/frame.pyi
+++ b/pandas-stubs/core/frame.pyi
@@ -1484,9 +1484,9 @@ class DataFrame(NDFrame, OpsMixin):
         column: _str | list[_str] | None = ...,
         by: _str | ListLike | None = ...,
         grid: _bool = ...,
-        xlabelsize: int | None = ...,
+        xlabelsize: float | str | None = ...,
         xrot: float | None = ...,
-        ylabelsize: int | None = ...,
+        ylabelsize: float | str | None = ...,
         yrot: float | None = ...,
         ax: PlotAxes | None = ...,
         sharex: _bool = ...,
diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi
index d624060a..5ccc4179 100644
--- a/pandas-stubs/core/groupby/generic.pyi
+++ b/pandas-stubs/core/groupby/generic.pyi
@@ -163,9 +163,9 @@ class SeriesGroupBy(GroupBy[Series[S1]], Generic[S1, ByT]):
         by: IndexLabel | None = ...,
         ax: PlotAxes | None = ...,
         grid: bool = ...,
-        xlabelsize: int | None = ...,
+        xlabelsize: float | str | None = ...,
         xrot: float | None = ...,
-        ylabelsize: int | None = ...,
+        ylabelsize: float | str | None = ...,
         yrot: float | None = ...,
         figsize: tuple[float, float] | None = ...,
         bins: int | Sequence[int] = ...,
@@ -358,9 +358,9 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
         column: IndexLabel | None = ...,
         by: IndexLabel | None = ...,
         grid: bool = ...,
-        xlabelsize: int | None = ...,
+        xlabelsize: float | str | None = ...,
         xrot: float | None = ...,
-        ylabelsize: int | None = ...,
+        ylabelsize: float | str | None = ...,
         yrot: float | None = ...,
         ax: PlotAxes | None = ...,
         sharex: bool = ...,
diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi
index ea770c09..e95d17ff 100644
--- a/pandas-stubs/core/series.pyi
+++ b/pandas-stubs/core/series.pyi
@@ -1174,9 +1174,9 @@ class Series(IndexOpsMixin[S1], NDFrame):
         by: object | None = ...,
         ax: PlotAxes | None = ...,
         grid: _bool = ...,
-        xlabelsize: int | None = ...,
+        xlabelsize: float | _str | None = ...,
         xrot: float | None = ...,
-        ylabelsize: int | None = ...,
+        ylabelsize: float | _str | None = ...,
         yrot: float | None = ...,
         figsize: tuple[float, float] | None = ...,
         bins: int | Sequence = ...,


Test patch:
diff --git a/tests/test_plotting.py b/tests/test_plotting.py
index 5d744350..1714bb71 100644
--- a/tests/test_plotting.py
+++ b/tests/test_plotting.py
@@ -627,8 +627,32 @@ def test_grouped_dataframe_hist(close_figures):
                 column="PetalWidth",
                 by="PetalLength",
                 grid=False,
-                xlabelsize=2,
-                ylabelsize=1,
+                xlabelsize=2.0,
+                ylabelsize=1.0,
+                yrot=10.0,
+                sharex=True,
+                sharey=False,
+                figsize=(1.5, 1.5),
+                bins=4,
+            ),
+            Series,
+        ),
+        Series,
+    )
+
+
+def test_grouped_dataframe_hist_str(close_figures):
+    df = IRIS_DF.iloc[:50]
+    grouped = df.groupby("Name")
+    check(assert_type(grouped.hist(), Series), Series)
+    check(
+        assert_type(
+            grouped.hist(
+                column="PetalWidth",
+                by="PetalLength",
+                grid=False,
+                xlabelsize="large",
+                ylabelsize="small",
                 yrot=10.0,
                 sharex=True,
                 sharey=False,