@@ -1387,8 +1387,52 @@ def set_data(self, A):
1387
1387
1388
1388
1389
1389
class 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.
1391
1404
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
+ """
1392
1436
def __init__ (self , bbox ,
1393
1437
* ,
1394
1438
cmap = None ,
@@ -1401,12 +1445,7 @@ def __init__(self, bbox,
1401
1445
resample = False ,
1402
1446
** kwargs
1403
1447
):
1404
- """
1405
- cmap is a colors.Colormap instance
1406
- norm is a colors.Normalize instance to map luminance to 0-1
1407
1448
1408
- kwargs are an optional list of Artist keyword args
1409
- """
1410
1449
super ().__init__ (
1411
1450
None ,
1412
1451
cmap = cmap ,
@@ -1422,12 +1461,11 @@ def __init__(self, bbox,
1422
1461
self .bbox = bbox
1423
1462
1424
1463
def get_window_extent (self , renderer = None ):
1425
- if renderer is None :
1426
- renderer = self .get_figure ()._get_renderer ()
1427
-
1428
1464
if isinstance (self .bbox , BboxBase ):
1429
1465
return self .bbox
1430
1466
elif callable (self .bbox ):
1467
+ if renderer is None :
1468
+ renderer = self .get_figure ()._get_renderer ()
1431
1469
return self .bbox (renderer )
1432
1470
else :
1433
1471
raise ValueError ("Unknown type of bbox" )
0 commit comments