@@ -265,14 +265,23 @@ def append_size(self, position, size):
265265 position = position )
266266
267267 def add_auto_adjustable_area (self , 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+ """
268281 if adjust_dirs is None :
269282 adjust_dirs = ["left" , "right" , "bottom" , "top" ]
270- from .axes_size import Padded , SizeFromFunc , GetExtentHelper
271283 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 )
276285
277286
278287class AxesLocator :
@@ -693,15 +702,20 @@ def make_axes_locatable(axes):
693702 return divider
694703
695704
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+ """
699715 if adjust_dirs is None :
700716 adjust_dirs = ["left" , "right" , "bottom" , "top" ]
701717 divider = make_axes_locatable (ax )
702-
703718 if use_axes is None :
704719 use_axes = ax
705-
706720 divider .add_auto_adjustable_area (use_axes = use_axes , pad = pad ,
707721 adjust_dirs = adjust_dirs )
0 commit comments