@@ -347,27 +347,33 @@ def __init__(self, fig, *args, horizontal=None, vertical=None,
347
347
(2, 3, 4)).
348
348
"""
349
349
self .figure = fig
350
- self ._subplotspec = SubplotSpec ._from_subplot_args (fig , args )
351
- self .update_params () # sets self.figbox
352
- super ().__init__ (fig , pos = self .figbox .bounds ,
350
+ super ().__init__ (fig , [0 , 0 , 1 , 1 ],
353
351
horizontal = horizontal or [], vertical = vertical or [],
354
352
aspect = aspect , anchor = anchor )
353
+ self .set_subplotspec (SubplotSpec ._from_subplot_args (fig , args ))
355
354
356
355
def get_position (self ):
357
356
"""Return the bounds of the subplot box."""
358
- self .update_params () # update self.figbox
359
- return self .figbox .bounds
357
+ return self .get_subplotspec ().get_position (self .figure ).bounds
360
358
359
+ @cbook .deprecated ("3.4" )
360
+ @property
361
+ def figbox (self ):
362
+ return self .get_subplotspec ().get_position (self .figure )
363
+
364
+ @cbook .deprecated ("3.4" )
361
365
def update_params (self ):
362
- """Update the subplot position from fig.subplotpars."""
363
- self .figbox = self .get_subplotspec ().get_position (self .figure )
366
+ pass
364
367
368
+ @cbook .deprecated (
369
+ "3.4" , alternative = "get_subplotspec" ,
370
+ addendum = "(get_subplotspec returns a SubplotSpec instance.)" )
365
371
def get_geometry (self ):
366
372
"""Get the subplot geometry, e.g., (2, 2, 3)."""
367
373
rows , cols , num1 , num2 = self .get_subplotspec ().get_geometry ()
368
374
return rows , cols , num1 + 1 # for compatibility
369
375
370
- # COVERAGE NOTE: Never used internally or from examples
376
+ @ cbook . deprecated ( "3.4" , alternative = "set_subplotspec" )
371
377
def change_geometry (self , numrows , numcols , num ):
372
378
"""Change subplot geometry, e.g., from (1, 1, 1) to (2, 2, 3)."""
373
379
self ._subplotspec = GridSpec (numrows , numcols )[num - 1 ]
@@ -381,6 +387,7 @@ def get_subplotspec(self):
381
387
def set_subplotspec (self , subplotspec ):
382
388
"""Set the SubplotSpec instance."""
383
389
self ._subplotspec = subplotspec
390
+ self .set_position (subplotspec .get_position (self .figure ))
384
391
385
392
386
393
class AxesDivider (Divider ):
0 commit comments