@@ -1015,8 +1015,6 @@ def _check_unsampled_image(self):
10151015 """Return False. Do not use unsampled image."""
10161016 return False
10171017
1018- is_grayscale = _api .deprecate_privatize_attribute ("3.3" )
1019-
10201018 def make_image (self , renderer , magnification = 1.0 , unsampled = False ):
10211019 # docstring inherited
10221020 if self ._A is None :
@@ -1027,11 +1025,9 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
10271025 if A .ndim == 2 :
10281026 if A .dtype != np .uint8 :
10291027 A = self .to_rgba (A , bytes = True )
1030- self ._is_grayscale = self .cmap .is_gray ()
10311028 else :
10321029 A = np .repeat (A [:, :, np .newaxis ], 4 , 2 )
10331030 A [:, :, 3 ] = 255
1034- self ._is_grayscale = True
10351031 else :
10361032 if A .dtype != np .uint8 :
10371033 A = (255 * A ).astype (np .uint8 )
@@ -1040,7 +1036,6 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
10401036 B [:, :, 0 :3 ] = A
10411037 B [:, :, 3 ] = 255
10421038 A = B
1043- self ._is_grayscale = False
10441039 vl = self .axes .viewLim
10451040 l , b , r , t = self .axes .bbox .extents
10461041 width = int (((round (r ) + 0.5 ) - (round (l ) - 0.5 )) * magnification )
@@ -1203,8 +1198,6 @@ def __init__(self, ax,
12031198 if A is not None :
12041199 self .set_data (x , y , A )
12051200
1206- is_grayscale = _api .deprecate_privatize_attribute ("3.3" )
1207-
12081201 def make_image (self , renderer , magnification = 1.0 , unsampled = False ):
12091202 # docstring inherited
12101203 if self ._A is None :
@@ -1215,8 +1208,6 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
12151208 if self ._rgbacache is None :
12161209 A = self .to_rgba (self ._A , bytes = True )
12171210 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 ()
12201211 padded_A = self ._rgbacache
12211212 bg = mcolors .to_rgba (self .axes .patch .get_facecolor (), 0 )
12221213 bg = (np .array (bg ) * 255 ).astype (np .uint8 )
@@ -1277,15 +1268,10 @@ def set_data(self, x, y, A):
12771268 (A .shape [:2 ], (y .size - 1 , x .size - 1 )))
12781269 if A .ndim not in [2 , 3 ]:
12791270 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
12831271 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 ]:
12891275 raise ValueError ("3D arrays must have RGB or RGBA as last dim" )
12901276
12911277 # For efficient cursor readout, ensure x and y are increasing.
0 commit comments