18
18
19
19
import matplotlib as mpl
20
20
from matplotlib import _api , _pylab_helpers , _tight_layout
21
+ from matplotlib ._api import UNSET as _UNSET
21
22
from matplotlib .transforms import Bbox
22
23
23
24
_log = logging .getLogger (__name__ )
@@ -366,7 +367,8 @@ def __init__(self, nrows, ncols, figure=None,
366
367
367
368
_AllowedKeys = ["left" , "bottom" , "right" , "top" , "wspace" , "hspace" ]
368
369
369
- def update (self , ** kwargs ):
370
+ def update (self , * , left = _UNSET , bottom = _UNSET , right = _UNSET , top = _UNSET ,
371
+ wspace = _UNSET , hspace = _UNSET ):
370
372
"""
371
373
Update the subplot parameters of the grid.
372
374
@@ -377,15 +379,23 @@ def update(self, **kwargs):
377
379
----------
378
380
left, right, top, bottom : float or None, optional
379
381
Extent of the subplots as a fraction of figure width or height.
380
- wspace, hspace : float, optional
382
+ wspace, hspace : float or None , optional
381
383
Spacing between the subplots as a fraction of the average subplot
382
384
width / height.
383
385
"""
384
- for k , v in kwargs .items ():
385
- if k in self ._AllowedKeys :
386
- setattr (self , k , v )
387
- else :
388
- raise AttributeError (f"{ k } is an unknown keyword" )
386
+ if left is not _UNSET :
387
+ self .left = left
388
+ if bottom is not _UNSET :
389
+ self .bottom = bottom
390
+ if right is not _UNSET :
391
+ self .right = right
392
+ if top is not _UNSET :
393
+ self .top = top
394
+ if wspace is not _UNSET :
395
+ self .wspace = wspace
396
+ if hspace is not _UNSET :
397
+ self .hspace = hspace
398
+
389
399
for figmanager in _pylab_helpers .Gcf .figs .values ():
390
400
for ax in figmanager .canvas .figure .axes :
391
401
if ax .get_subplotspec () is not None :
0 commit comments