27
27
from pandas .core .base import PandasObject
28
28
29
29
if TYPE_CHECKING :
30
+ from matplotlib .axes import Axes
31
+
30
32
from pandas import DataFrame
31
33
32
34
@@ -463,16 +465,16 @@ def hist_frame(
463
465
@Substitution (backend = "" )
464
466
@Appender (_boxplot_doc )
465
467
def boxplot (
466
- data ,
467
- column = None ,
468
- by = None ,
469
- ax = None ,
470
- fontsize = None ,
471
- rot = 0 ,
472
- grid = True ,
473
- figsize = None ,
474
- layout = None ,
475
- return_type = None ,
468
+ data : DataFrame ,
469
+ column : str | list [ str ] | None = None ,
470
+ by : str | list [ str ] | None = None ,
471
+ ax : Axes | None = None ,
472
+ fontsize : float | str | None = None ,
473
+ rot : int = 0 ,
474
+ grid : bool = True ,
475
+ figsize : tuple [ float , float ] | None = None ,
476
+ layout : tuple [ int , int ] | None = None ,
477
+ return_type : str | None = None ,
476
478
** kwargs ,
477
479
):
478
480
plot_backend = _get_plot_backend ("matplotlib" )
@@ -499,8 +501,8 @@ def boxplot_frame(
499
501
by = None ,
500
502
ax = None ,
501
503
fontsize = None ,
502
- rot = 0 ,
503
- grid = True ,
504
+ rot : int = 0 ,
505
+ grid : bool = True ,
504
506
figsize = None ,
505
507
layout = None ,
506
508
return_type = None ,
@@ -525,16 +527,16 @@ def boxplot_frame(
525
527
526
528
def boxplot_frame_groupby (
527
529
grouped ,
528
- subplots = True ,
530
+ subplots : bool = True ,
529
531
column = None ,
530
532
fontsize = None ,
531
- rot = 0 ,
532
- grid = True ,
533
+ rot : int = 0 ,
534
+ grid : bool = True ,
533
535
ax = None ,
534
536
figsize = None ,
535
537
layout = None ,
536
- sharex = False ,
537
- sharey = True ,
538
+ sharex : bool = False ,
539
+ sharey : bool = True ,
538
540
backend = None ,
539
541
** kwargs ,
540
542
):
@@ -1041,7 +1043,7 @@ def __call__(self, *args, **kwargs):
1041
1043
)
1042
1044
@Substitution (kind = "line" )
1043
1045
@Appender (_bar_or_line_doc )
1044
- def line (self , x = None , y = None , ** kwargs ):
1046
+ def line (self , x = None , y = None , ** kwargs ) -> PlotAccessor :
1045
1047
"""
1046
1048
Plot Series or DataFrame as lines.
1047
1049
@@ -1128,7 +1130,7 @@ def line(self, x=None, y=None, **kwargs):
1128
1130
)
1129
1131
@Substitution (kind = "bar" )
1130
1132
@Appender (_bar_or_line_doc )
1131
- def bar (self , x = None , y = None , ** kwargs ):
1133
+ def bar (self , x = None , y = None , ** kwargs ) -> PlotAccessor :
1132
1134
"""
1133
1135
Vertical bar plot.
1134
1136
@@ -1214,7 +1216,7 @@ def bar(self, x=None, y=None, **kwargs):
1214
1216
)
1215
1217
@Substitution (kind = "bar" )
1216
1218
@Appender (_bar_or_line_doc )
1217
- def barh (self , x = None , y = None , ** kwargs ):
1219
+ def barh (self , x = None , y = None , ** kwargs ) -> PlotAccessor :
1218
1220
"""
1219
1221
Make a horizontal bar plot.
1220
1222
@@ -1226,7 +1228,7 @@ def barh(self, x=None, y=None, **kwargs):
1226
1228
"""
1227
1229
return self (kind = "barh" , x = x , y = y , ** kwargs )
1228
1230
1229
- def box (self , by = None , ** kwargs ):
1231
+ def box (self , by = None , ** kwargs ) -> PlotAccessor :
1230
1232
r"""
1231
1233
Make a box plot of the DataFrame columns.
1232
1234
@@ -1293,7 +1295,7 @@ def box(self, by=None, **kwargs):
1293
1295
"""
1294
1296
return self (kind = "box" , by = by , ** kwargs )
1295
1297
1296
- def hist (self , by = None , bins = 10 , ** kwargs ):
1298
+ def hist (self , by = None , bins : int = 10 , ** kwargs ) -> PlotAccessor :
1297
1299
"""
1298
1300
Draw one histogram of the DataFrame's columns.
1299
1301
@@ -1355,7 +1357,7 @@ def hist(self, by=None, bins=10, **kwargs):
1355
1357
"""
1356
1358
return self (kind = "hist" , by = by , bins = bins , ** kwargs )
1357
1359
1358
- def kde (self , bw_method = None , ind = None , ** kwargs ):
1360
+ def kde (self , bw_method = None , ind = None , ** kwargs ) -> PlotAccessor :
1359
1361
"""
1360
1362
Generate Kernel Density Estimate plot using Gaussian kernels.
1361
1363
@@ -1465,7 +1467,7 @@ def kde(self, bw_method=None, ind=None, **kwargs):
1465
1467
1466
1468
density = kde
1467
1469
1468
- def area (self , x = None , y = None , ** kwargs ):
1470
+ def area (self , x = None , y = None , ** kwargs ) -> PlotAccessor :
1469
1471
"""
1470
1472
Draw a stacked area plot.
1471
1473
@@ -1538,7 +1540,7 @@ def area(self, x=None, y=None, **kwargs):
1538
1540
"""
1539
1541
return self (kind = "area" , x = x , y = y , ** kwargs )
1540
1542
1541
- def pie (self , ** kwargs ):
1543
+ def pie (self , ** kwargs ) -> PlotAccessor :
1542
1544
"""
1543
1545
Generate a pie plot.
1544
1546
@@ -1593,7 +1595,7 @@ def pie(self, **kwargs):
1593
1595
raise ValueError ("pie requires either y column or 'subplots=True'" )
1594
1596
return self (kind = "pie" , ** kwargs )
1595
1597
1596
- def scatter (self , x , y , s = None , c = None , ** kwargs ):
1598
+ def scatter (self , x , y , s = None , c = None , ** kwargs ) -> PlotAccessor :
1597
1599
"""
1598
1600
Create a scatter plot with varying marker point size and color.
1599
1601
@@ -1699,7 +1701,9 @@ def scatter(self, x, y, s=None, c=None, **kwargs):
1699
1701
1700
1702
return self (kind = "scatter" , x = x , y = y , ** kwargs )
1701
1703
1702
- def hexbin (self , x , y , C = None , reduce_C_function = None , gridsize = None , ** kwargs ):
1704
+ def hexbin (
1705
+ self , x , y , C = None , reduce_C_function = None , gridsize = None , ** kwargs
1706
+ ) -> PlotAccessor :
1703
1707
"""
1704
1708
Generate a hexagonal binning plot.
1705
1709
0 commit comments