1
- from typing import TYPE_CHECKING
1
+ from typing import TYPE_CHECKING , Optional
2
2
3
3
import numpy as np
4
4
16
16
17
17
if TYPE_CHECKING :
18
18
from matplotlib .axes import Axes
19
+ from matplotlib .figure import Figure
19
20
20
21
21
22
class HistPlot (LinePlot ):
@@ -181,6 +182,7 @@ def _grouped_plot(
181
182
column = None ,
182
183
by = None ,
183
184
numeric_only = True ,
185
+ figure : Optional ["Figure" ] = None ,
184
186
figsize = None ,
185
187
sharex = True ,
186
188
sharey = True ,
@@ -203,7 +205,13 @@ def _grouped_plot(
203
205
204
206
naxes = len (grouped )
205
207
fig , axes = create_subplots (
206
- naxes = naxes , figsize = figsize , sharex = sharex , sharey = sharey , ax = ax , layout = layout
208
+ naxes = naxes ,
209
+ figure = figure ,
210
+ figsize = figsize ,
211
+ sharex = sharex ,
212
+ sharey = sharey ,
213
+ ax = ax ,
214
+ layout = layout ,
207
215
)
208
216
209
217
_axes = flatten_axes (axes )
@@ -222,6 +230,7 @@ def _grouped_hist(
222
230
data ,
223
231
column = None ,
224
232
by = None ,
233
+ figure = None ,
225
234
ax = None ,
226
235
bins = 50 ,
227
236
figsize = None ,
@@ -245,6 +254,7 @@ def _grouped_hist(
245
254
data : Series/DataFrame
246
255
column : object, optional
247
256
by : object, optional
257
+ figure: figure, optional
248
258
ax : axes, optional
249
259
bins : int, default 50
250
260
figsize : tuple, optional
@@ -282,6 +292,7 @@ def plot_group(group, ax):
282
292
data ,
283
293
column = column ,
284
294
by = by ,
295
+ figure = figure ,
285
296
sharex = sharex ,
286
297
sharey = sharey ,
287
298
ax = ax ,
@@ -381,6 +392,7 @@ def hist_frame(
381
392
xrot = None ,
382
393
ylabelsize = None ,
383
394
yrot = None ,
395
+ figure = None ,
384
396
ax = None ,
385
397
sharex = False ,
386
398
sharey = False ,
@@ -397,6 +409,7 @@ def hist_frame(
397
409
data ,
398
410
column = column ,
399
411
by = by ,
412
+ figure = figure ,
400
413
ax = ax ,
401
414
grid = grid ,
402
415
figsize = figsize ,
@@ -430,6 +443,7 @@ def hist_frame(
430
443
431
444
fig , axes = create_subplots (
432
445
naxes = naxes ,
446
+ figure = figure ,
433
447
ax = ax ,
434
448
squeeze = False ,
435
449
sharex = sharex ,
0 commit comments