@@ -903,6 +903,10 @@ def __init__(self, ax,
903
903
** kwargs
904
904
)
905
905
906
+ #support array value in imshow
907
+ if isinstance (self ._alpha , np .ndarray ):
908
+ self ._set_alpha_for_array (self ._alpha )
909
+
906
910
def get_window_extent (self , renderer = None ):
907
911
x0 , x1 , y0 , y1 = self ._extent
908
912
bbox = Bbox .from_extents ([x0 , y0 , x1 , y1 ])
@@ -1579,8 +1583,10 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
1579
1583
1580
1584
.. note::
1581
1585
1582
- If you want to save a single channel image as gray scale please use an
1583
- image I/O library (such as pillow, tifffile, or imageio) directly.
1586
+ If *arr* is a single-channel (MxN) image and you want to save it as a grayscale image
1587
+ (instead of applying a colormap), consider using a dedicated image I/O library like
1588
+ Pillow, imageio, or tifffile. `imsave` will apply a colormap by default.
1589
+
1584
1590
1585
1591
Parameters
1586
1592
----------
@@ -1658,6 +1664,7 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
1658
1664
else :
1659
1665
sm = mcolorizer .Colorizer (cmap = cmap )
1660
1666
sm .set_clim (vmin , vmax )
1667
+
1661
1668
rgba = sm .to_rgba (arr , bytes = True )
1662
1669
if pil_kwargs is None :
1663
1670
pil_kwargs = {}
0 commit comments