@@ -1374,8 +1374,52 @@ def set_data(self, A):
1374
1374
1375
1375
1376
1376
class 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.
1378
1391
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
+ """
1379
1423
def __init__ (self , bbox ,
1380
1424
* ,
1381
1425
cmap = None ,
@@ -1388,12 +1432,7 @@ def __init__(self, bbox,
1388
1432
resample = False ,
1389
1433
** kwargs
1390
1434
):
1391
- """
1392
- cmap is a colors.Colormap instance
1393
- norm is a colors.Normalize instance to map luminance to 0-1
1394
1435
1395
- kwargs are an optional list of Artist keyword args
1396
- """
1397
1436
super ().__init__ (
1398
1437
None ,
1399
1438
cmap = cmap ,
@@ -1409,12 +1448,11 @@ def __init__(self, bbox,
1409
1448
self .bbox = bbox
1410
1449
1411
1450
def get_window_extent (self , renderer = None ):
1412
- if renderer is None :
1413
- renderer = self .get_figure ()._get_renderer ()
1414
-
1415
1451
if isinstance (self .bbox , BboxBase ):
1416
1452
return self .bbox
1417
1453
elif callable (self .bbox ):
1454
+ if renderer is None :
1455
+ renderer = self .get_figure ()._get_renderer ()
1418
1456
return self .bbox (renderer )
1419
1457
else :
1420
1458
raise ValueError ("Unknown type of bbox" )
0 commit comments