@@ -265,14 +265,23 @@ def append_size(self, position, size):
265
265
position = position )
266
266
267
267
def add_auto_adjustable_area (s
D100
elf , use_axes , pad = 0.1 , adjust_dirs = None ):
268
+ """
269
+ Add auto-adjustable padding around *use_axes* to take their decorations
270
+ (title, labels, ticks, ticklabels) into account during layout.
271
+
272
+ Parameters
273
+ ----------
274
+ use_axes : `~.axes.Axes` or list of `~.axes.Axes`
275
+ The Axes whose decorations are taken into account.
276
+ pad : float, optional
277
+ Additional padding in inches.
278
+ adjust_dirs : list of {"left", "right", "bottom", "top"}, optional
279
+ The sides where padding is added; defaults to all four sides.
280
+ """
268
281
if adjust_dirs is None :
269
282
adjust_dirs = ["left" , "right" , "bottom" , "top" ]
270
- from .axes_size import Padded , SizeFromFunc , GetExtentHelper
271
283
for d in adjust_dirs :
272
- helper = GetExtentHelper (use_axes , d )
273
- size = SizeFromFunc (helper )
274
- padded_size = Padded (size , pad ) # pad in inch
275
- self .append_size (d , padded_size )
284
+ self .append_size (d , Size ._AxesDecorationsSize (use_axes , d ) + pad )
276
285
277
286
278
287
class AxesLocator :
@@ -693,15 +702,20 @@ def make_axes_locatable(axes):
693
702
return divider
694
703
695
704
696
- def make_axes_area_auto_adjustable (ax ,
697
- use_axes = None , pad = 0.1 ,
698
- adjust_dirs = None ):
705
+ def make_axes_area_auto_adjustable (
706
+ ax , use_axes = None , pad = 0.1 , adjust_dirs = None ):
707
+ """
708
+ Add auto-adjustable padding around *ax* to take its decorations (title,
709
+ labels, ticks, ticklabels) into account during layout, using
710
+ `Divider.add_auto_adjustable_area`.
711
+
712
+ By default, padding is determined from the decorations of *ax*.
713
+ Pass *use_axes* to consider the decorations of other Axes instead.
714
+ """
699
715
if adjust_dirs is None :
700
716
adjust_dirs = ["left" , "right" , "bottom" , "top" ]
701
717
divider = make_axes_locatable (ax )
702
-
703
718
if use_axes is None :
704
719
use_axes = ax
705
-
706
720
divider .add_auto_adjustable_area (use_axes = use_axes , pad = pad ,
707
721
adjust_dirs = adjust_dirs )
0 commit comments