@@ -1374,8 +1374,52 @@ def set_data(self, A):
13741374
13751375
13761376class BboxImage (_ImageBase ):
1377- """The Image class whose size is determined by the given bbox."""
1377+ """
1378+ The Image class whose size is determined by the given bbox.
1379+
1380+ Parameters
1381+ ----------
1382+ bbox : BboxBase or Callable[RendererBase, BboxBase]
1383+ The bbox or a function to generate the bbox
1384+
1385+ .. warning ::
1386+
1387+ If using `matplotlib.artist.Artist.get_window_extent` as the
1388+ callable ensure that the other artist is drawn first (lower zorder)
1389+ or you may need to renderer the figure twice to ensure that the
1390+ computed bbox is accurate.
13781391
1392+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
1393+ The Colormap instance or registered colormap name used to map scalar
1394+ data to colors.
1395+ norm : str or `~matplotlib.colors.Normalize`
1396+ Maps luminance to 0-1.
1397+ interpolation : str, default: :rc:`image.interpolation`
1398+ Supported values are 'none', 'auto', 'nearest', 'bilinear',
1399+ 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite',
1400+ 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
1401+ 'sinc', 'lanczos', 'blackman'.
1402+ origin : {'upper', 'lower'}, default: :rc:`image.origin`
1403+ Place the [0, 0] index of the array in the upper left or lower left
1404+ corner of the Axes. The convention 'upper' is typically used for
1405+ matrices and images.
1406+ filternorm : bool, default: True
1407+ A parameter for the antigrain image resize filter
1408+ (see the antigrain documentation).
1409+ If filternorm is set, the filter normalizes integer values and corrects
1410+ the rounding errors. It doesn't do anything with the source floating
1411+ point values, it corrects only integers according to the rule of 1.0
1412+ which means that any sum of pixel weights must be equal to 1.0. So,
1413+ the filter function must produce a graph of the proper shape.
1414+ filterrad : float > 0, default: 4
1415+ The filter radius for filters that have a radius parameter, i.e. when
1416+ interpolation is one of: 'sinc', 'lanczos' or 'blackman'.
1417+ resample : bool, default: False
1418+ When True, use a full resampling method. When False, only resample when
1419+ the output image is larger than the input image.
1420+ **kwargs : `~matplotlib.artist.Artist` properties
1421+
1422+ """
13791423 def __init__ (self , bbox ,
13801424 * ,
13811425 cmap = None ,
@@ -1388,12 +1432,7 @@ def __init__(self, bbox,
13881432 resample = False ,
13891433 ** kwargs
13901434 ):
1391- """
1392- cmap is a colors.Colormap instance
1393- norm is a colors.Normalize instance to map luminance to 0-1
13941435
1395- kwargs are an optional list of Artist keyword args
1396- """
13971436 super ().__init__ (
13981437 None ,
13991438 cmap = cmap ,
@@ -1409,12 +1448,11 @@ def __init__(self, bbox,
14091448 self .bbox = bbox
14101449
14111450 def get_window_extent (self , renderer = None ):
1412- if renderer is None :
1413- renderer = self .get_figure ()._get_renderer ()
1414-
14151451 if isinstance (self .bbox , BboxBase ):
14161452 return self .bbox
14171453 elif callable (self .bbox ):
1454+ if renderer is None :
1455+ renderer = self .get_figure ()._get_renderer ()
14181456 return self .bbox (renderer )
14191457 else :
14201458 raise ValueError ("Unknown type of bbox" )
0 commit comments