@@ -1387,8 +1387,52 @@ def set_data(self, A):
13871387
13881388
13891389class BboxImage (_ImageBase ):
1390- """The Image class whose size is determined by the given bbox."""
1390+ """
1391+ The Image class whose size is determined by the given bbox.
1392+
1393+ Parameters
1394+ ----------
1395+ bbox : BboxBase or Callable[RendererBase, BboxBase]
1396+ The bbox or a function to generate the bbox
1397+
1398+ .. warning ::
1399+
1400+ If using `matplotlib.artist.Artist.get_window_extent` as the
1401+ callable ensure that the other artist is drawn first (lower zorder)
1402+ or you may need to renderer the figure twice to ensure that the
1403+ computed bbox is accurate.
13911404
1405+ cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
1406+ The Colormap instance or registered colormap name used to map scalar
1407+ data to colors.
1408+ norm : str or `~matplotlib.colors.Normalize`
1409+ Maps luminance to 0-1.
1410+ interpolation : str, default: :rc:`image.interpolation`
1411+ Supported values are 'none', 'auto', 'nearest', 'bilinear',
1412+ 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite',
1413+ 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
1414+ 'sinc', 'lanczos', 'blackman'.
1415+ origin : {'upper', 'lower'}, default: :rc:`image.origin`
1416+ Place the [0, 0] index of the array in the upper left or lower left
1417+ corner of the Axes. The convention 'upper' is typically used for
1418+ matrices and images.
1419+ filternorm : bool, default: True
1420+ A parameter for the antigrain image resize filter
1421+ (see the antigrain documentation).
1422+ If filternorm is set, the filter normalizes integer values and corrects
1423+ the rounding errors. It doesn't do anything with the source floating
1424+ point values, it corrects only integers according to the rule of 1.0
1425+ which means that any sum of pixel weights must be equal to 1.0. So,
1426+ the filter function must produce a graph of the proper shape.
1427+ filterrad : float > 0, default: 4
1428+ The filter radius for filters that have a radius parameter, i.e. when
1429+ interpolation is one of: 'sinc', 'lanczos' or 'blackman'.
1430+ resample : bool, default: False
1431+ When True, use a full resampling method. When False, only resample when
1432+ the output image is larger than the input image.
1433+ **kwargs : `~matplotlib.artist.Artist` properties
1434+
1435+ """
13921436 def __init__ (self , bbox ,
13931437 * ,
13941438 cmap = None ,
@@ -1401,12 +1445,7 @@ def __init__(self, bbox,
14011445 resample = False ,
14021446 ** kwargs
14031447 ):
1404- """
1405- cmap is a colors.Colormap instance
1406- norm is a colors.Normalize instance to map luminance to 0-1
14071448
1408- kwargs are an optional list of Artist keyword args
1409- """
14101449 super ().__init__ (
14111450 None ,
14121451 cmap = cmap ,
@@ -1422,12 +1461,11 @@ def __init__(self, bbox,
14221461 self .bbox = bbox
14231462
14241463 def get_window_extent (self , renderer = None ):
1425- if renderer is None :
1426- renderer = self .get_figure ()._get_renderer ()
1427-
14281464 if isinstance (self .bbox , BboxBase ):
14291465 return self .bbox
14301466 elif callable (self .bbox ):
1467+ if renderer is None :
1468+ renderer = self .get_figure ()._get_renderer ()
14311469 return self .bbox (renderer )
14321470 else :
14331471 raise ValueError ("Unknown type of bbox" )
0 commit comments