@@ -1440,6 +1440,79 @@ def subplot(*args, **kwargs) -> Axes:
14401440 return ax
14411441
14421442
1443+ # NOTE The actual type is `Axes` or `numpy.ndarray`,
1444+ # but `numpy.ndarray` does notsupport objects.
1445+ # NOTE Since there is no Exclude-type in Python's type hints, it is assumed that
1446+ # the overload that matches first will be resolved.
1447+ # mypy warns that it is an unsafe overload, so mark it as ignore.
1448+ @overload # type: ignore[misc]
1449+ def subplots (
1450+ nrows : Literal [1 ] = ...,
1451+ ncols : Literal [1 ] = ...,
1452+ * ,
1453+ sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1454+ sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1455+ squeeze : Literal [True ] = ...,
1456+ width_ratios : Sequence [float ] | None = ...,
1457+ height_ratios : Sequence [float ] | None = ...,
1458+ subplot_kw : dict [str , Any ] | None = ...,
1459+ gridspec_kw : dict [str , Any ] | None = ...,
1460+ ** fig_kw
1461+ ) -> tuple [Figure , Axes ]:
1462+ ...
1463+
1464+
1465+ @overload # type: ignore[misc]
1466+ def subplots (
1467+ nrows : Literal [1 ] = ...,
1468+ ncols : int = ...,
1469+ * ,
1470+ sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1471+ sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1472+ squeeze : Literal [True ] = ...,
1473+ width_ratios : Sequence [float ] | None = ...,
1474+ height_ratios : Sequence [float ] | None = ...,
1475+ subplot_kw : dict [str , Any ] | None = ...,
1476+ gridspec_kw : dict [str , Any ] | None = ...,
1477+ ** fig_kw
1478+ ) -> tuple [Figure , Sequence [Axes ]]:
1479+ ...
1480+
1481+
1482+ @overload # type: ignore[misc]
1483+ def subplots (
1484+ nrows : int = ...,
1485+ ncols : Literal [1 ] = ...,
1486+ * ,
1487+ sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1488+ sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1489+ squeeze : Literal [True ] = ...,
1490+ width_ratios : Sequence [float ] | None = ...,
1491+ height_ratios : Sequence [float ] | None = ...,
1492+ subplot_kw : dict [str , Any ] | None = ...,
1493+ gridspec_kw : dict [str , Any ] | None = ...,
1494+ ** fig_kw
1495+ ) -> tuple [Figure , Sequence [Axes ]]:
1496+ ...
1497+
1498+
1499+ @overload # type: ignore[misc]
1500+ def subplots (
1501+ nrows : int = ...,
1502+ ncols : int = ...,
1503+ * ,
1504+ sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1505+ sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1506+ squeeze : Literal [False ] = ...,
1507+ width_ratios : Sequence [float ] | None = ...,
1508+ height_ratios : Sequence [float ] | None = ...,
1509+ subplot_kw : dict [str , Any ] | None = ...,
1510+ gridspec_kw : dict [str , Any ] | None = ...,
1511+ ** fig_kw
1512+ ) -> tuple [Figure , Sequence [Sequence [Axes ]]]:
1513+ ...
1514+
1515+
14431516def subplots (
14441517 nrows : int = 1 , ncols : int = 1 , * ,
14451518 sharex : bool | Literal ["none" , "all" , "row" , "col" ] = False ,
0 commit comments