@@ -982,6 +982,11 @@ def _check_unsampled_image(self, renderer):
982982"""Return False. Do not use unsampled image."""
983983return False
984984
985+ @cbook .deprecated ("3.3" )
986+ @property
987+ def is_grayscale (self ):
988+ return self ._is_grayscale
989+
985990def make_image (self ,renderer ,magnification = 1.0 ,unsampled = False ):
986991# docstring inherited
987992if self ._A is None :
@@ -992,11 +997,11 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
992997if A .ndim == 2 :
993998if A .dtype != np .uint8 :
994999A = self .to_rgba (A ,bytes = True )
995- self .is_grayscale = self .cmap .is_gray ()
1000+ self ._is_grayscale = self .cmap .is_gray ()
9961001else :
9971002A = np .repeat (A [:, :,np .newaxis ],4 ,2 )
9981003A [:, :,3 ]= 255
999- self .is_grayscale = True
1004+ self ._is_grayscale = True
10001005else :
10011006if A .dtype != np .uint8 :
10021007A = (255 * A ).astype (np .uint8 )
@@ -1005,7 +1010,7 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
10051010B [:, :,0 :3 ]= A
10061011B [:, :,3 ]= 255
10071012A = B
1008- self .is_grayscale = False
1013+ self ._is_grayscale = False
10091014x0 ,y0 ,v_width ,v_height = self .axes .viewLim .bounds
10101015l ,b ,r ,t = self .axes .bbox .extents
10111016width = (round (r )+ 0.5 )- (round (l )- 0.5 )
@@ -1115,6 +1120,11 @@ def __init__(self, ax,
11151120if A is not None :
11161121self .set_data (x ,y ,A )
11171122
1123+ @cbook .deprecated ("3.3" )
1124+ @property
1125+ def is_grayscale (self ):
1126+ return self ._is_grayscale
1127+
11181128def make_image (self ,renderer ,magnification = 1.0 ,unsampled = False ):
11191129# docstring inherited
11201130if self ._A is None :
@@ -1134,7 +1144,7 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
11341144A = self .to_rgba (self ._A ,bytes = True )
11351145self ._rgbacache = A
11361146if self ._A .ndim == 2 :
1137- self .is_grayscale = self .cmap .is_gray ()
1147+ self ._is_grayscale = self .cmap .is_gray ()
11381148else :
11391149A = self ._rgbacache
11401150vl = self .axes .viewLim
@@ -1180,12 +1190,12 @@ def set_data(self, x, y, A):
11801190raise ValueError ("A must be 2D or 3D" )
11811191if A .ndim == 3 and A .shape [2 ]== 1 :
11821192A .shape = A .shape [:2 ]
1183- self .is_grayscale = False
1193+ self ._is_grayscale = False
11841194if A .ndim == 3 :
11851195if A .shape [2 ]in [3 ,4 ]:
11861196if ((A [:, :,0 ]== A [:, :,1 ]).all ()and
11871197 (A [:, :,0 ]== A [:, :,2 ]).all ()):
1188- self .is_grayscale = True
1198+ self ._is_grayscale = True
11891199else :
11901200raise ValueError ("3D arrays must have RGB or RGBA as last dim" )
11911201