@@ -979,7 +979,7 @@ def colorbar(self, *args, loc=None, pad=None,
979979 height_ratios = ((1 - length ) / 2 , length , (1 - length ) / 2 ),
980980 )
981981 subplotspec = gridspec [1 ]
982- with self .figure ._unlock ():
982+ with self .figure ._authorize_add_subplot ():
983983 ax = self .figure .add_subplot (subplotspec , projection = None )
984984 if ax is self :
985985 raise ValueError (f'Uh oh.' )
@@ -1190,8 +1190,9 @@ def draw(self, renderer=None, *args, **kwargs):
11901190 def get_size_inches (self ):
11911191 """Returns the width and the height of the axes in inches."""
11921192 width , height = self .figure .get_size_inches ()
1193- width = width * abs (self .get_position ().width )
1194- height = height * abs (self .get_position ().height )
1193+ bbox = self .get_position ()
1194+ width = width * abs (bbox .width )
1195+ height = height * abs (bbox .height )
11951196 return width , height
11961197
11971198 def get_tightbbox (self , renderer , * args , ** kwargs ):
@@ -2537,7 +2538,7 @@ def altx(self):
25372538 # See https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_subplots.py # noqa
25382539 if self ._altx_child or self ._altx_parent :
25392540 raise RuntimeError ('No more than *two* twin axes are allowed.' )
2540- with self .figure ._unlock ():
2541+ with self .figure ._authorize_add_subplot ():
25412542 ax = self ._make_twin_axes (sharey = self , projection = 'xy' )
25422543 ax .set_autoscaley_on (self .get_autoscaley_on ())
25432544 ax .grid (False )
@@ -2552,7 +2553,7 @@ def altx(self):
25522553 def alty (self ):
25532554 if self ._alty_child or self ._alty_parent :
25542555 raise RuntimeError ('No more than *two* twin axes are allowed.' )
2555- with self .figure ._unlock ():
2556+ with self .figure ._authorize_add_subplot ():
25562557 ax = self ._make_twin_axes (sharex = self , projection = 'xy' )
25572558 ax .set_autoscalex_on (self .get_autoscalex_on ())
25582559 ax .grid (False )
0 commit comments