@@ -1015,8 +1015,6 @@ def _check_unsampled_image(self):
1015
1015
"""Return False. Do not use unsampled image."""
1016
1016
return False
1017
1017
1018
- is_grayscale = _api .deprecate_privatize_attribute ("3.3" )
1019
-
1020
1018
def make_image (self , renderer , magnification = 1.0 , unsampled = False ):
1021
1019
# docstring inherited
1022
1020
if self ._A is None :
@@ -1027,11 +1025,9 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
1027
1025
if A .ndim == 2 :
1028
1026
if A .dtype != np .uint8 :
1029
1027
A = self .to_rgba (A , bytes = True )
1030
- self ._is_grayscale = self .cmap .is_gray ()
1031
1028
else :
1032
1029
A = np .repeat (A [:, :, np .newaxis ], 4 , 2 )
1033
1030
A [:, :, 3 ] = 255
1034
- self ._is_grayscale = True
1035
1031
else :
1036
1032
if A .dtype != np .uint8 :
1037
1033
A = (255 * A ).astype (np .uint8 )
@@ -1040,7 +1036,6 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
1040
1036
B [:, :, 0 :3 ] = A
1041
1037
B [:, :, 3 ] = 255
1042
1038
A = B
1043
- self ._is_grayscale = False
1044
1039
vl = self .axes .viewLim
1045
1040
l , b , r , t = self .axes .bbox .extents
1046
1041
width = int (((round (r ) + 0.5 ) - (round (l ) - 0.5 )) * magnification )
@@ -1203,8 +1198,6 @@ def __init__(self, ax,
1203
1198
if A is not None :
1204
1199
self .set_data (x , y , A )
1205
1200
1206
- is_grayscale = _api .deprecate_privatize_attribute ("3.3" )
1207
-
1208
1201
def make_image (self , renderer , magnification = 1.0 , unsampled = False ):
1209
1202
# docstring inherited
1210
1203
if self ._A is None :
@@ -1215,8 +1208,6 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
1215
1208
if self ._rgbacache is None :
1216
1209
A = self .to_rgba (self ._A , bytes = True )
1217
1210
self ._rgbacache = np .pad (A , [(1 , 1 ), (1 , 1 ), (0 , 0 )], "constant" )
1218
- if self ._A .ndim == 2 :
1219
- self ._is_grayscale = self .cmap .is_gray ()
1220
1211
padded_A = self ._rgbacache
1221
1212
bg = mcolors .to_rgba (self .axes .patch .get_facecolor (), 0 )
1222
1213
bg = (np .array (bg ) * 255 ).astype (np .uint8 )
@@ -1277,15 +1268,10 @@ def set_data(self, x, y, A):
1277
1268
(A .shape [:2 ], (y .size - 1 , x .size - 1 )))
1278
1269
if A .ndim not in [2 , 3 ]:
1279
1270
raise ValueError ("A must be 2D or 3D" )
1280
- if A .ndim == 3 and A .shape [2 ] == 1 :
1281
- A = A .squeeze (axis = - 1 )
1282
- self ._is_grayscale = False
1283
1271
if A .ndim == 3 :
1284
- if A .shape [2 ] in [3 , 4 ]:
1285
- if ((A [:, :, 0 ] == A [:, :, 1 ]).all () and
1286
- (A [:, :, 0 ] == A [:, :, 2 ]).all ()):
1287
- self ._is_grayscale = True
1288
- else :
1272
+ if A .shape [2 ] == 1 :
1273
+ A = A .squeeze (axis = - 1 )
1274
+ elif A .shape [2 ] not in [3 , 4 ]:
1289
1275
raise ValueError ("3D arrays must have RGB or RGBA as last dim" )
1290
1276
1291
1277
# For efficient cursor readout, ensure x and y are increasing.
0 commit comments