@@ -5150,6 +5150,13 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
5150
5150
"'mcolors.BivariateNorm'" )
5151
5151
raise ValueError (msg )
5152
5152
5153
+ is_bivari = (X .ndim == 3 or X .shape [0 ] == 2 )
5154
+ if is_bivari :
5155
+ if cmap is None :
5156
+ cmap = mcolors .BivariateColormap ()
5157
+ if norm is None :
5158
+ norm = mcolors .BivariateNorm ()
5159
+
5153
5160
if aspect is None :
5154
5161
aspect = rcParams ['image.aspect' ]
5155
5162
self .set_aspect (aspect )
@@ -5194,17 +5201,11 @@ def _pcolorargs(funcname, *args, **kw):
5194
5201
allmatch = kw .pop ("allmatch" , False )
5195
5202
norm = kw .pop ("norm" , None )
5196
5203
cmap = kw .pop ("cmap" , None )
5197
- alpha = kw .pop ("alpha" , 1 )
5198
5204
5199
5205
if len (args ) == 1 :
5200
5206
C = np .asanyarray (args [0 ])
5201
- is_bivari = (isinstance (norm , mcolors .BivariateNorm ) or
5202
- isinstance (cmap , mcolors .BivariateColormap ))
5203
- if (C .ndim == 3 and is_bivari ):
5204
- if cmap is None :
5205
- cmap = mcolors .BivariateColormap ()
5206
- if norm is None :
5207
- norm = mcolors .BivariateNorm ()
5207
+ is_bivari = (C .ndim == 3 or C .shape [0 ] == 2 )
5208
+ if is_bivari :
5208
5209
numRows , numCols = C .shape [1 :]
5209
5210
else :
5210
5211
numRows , numCols = C .shape
@@ -5218,9 +5219,8 @@ def _pcolorargs(funcname, *args, **kw):
5218
5219
5219
5220
if len (args ) == 3 :
5220
5221
X , Y , C = [np .asanyarray (a ) for a in args ]
5221
- is_bivari = (isinstance (norm , mcolors .BivariateNorm ) or
5222
- isinstance (cmap , mcolors .BivariateColormap ))
5223
- if (C .ndim == 3 and is_bivari ):
5222
+ is_bivari = (C .ndim == 3 or C .shape [0 ] == 2 )
5223
+ if is_bivari :
5224
5224
if cmap is None :
5225
5225
cmap = mcolors .BivariateColormap ()
5226
5226
if norm is None :
@@ -5413,6 +5413,13 @@ def pcolor(self, *args, **kwargs):
5413
5413
X , Y , C = self ._pcolorargs ('pcolor' , * args , ** kw )
5414
5414
Ny , Nx = X .shape
5415
5415
5416
+ is_bivari = (C .ndim == 3 or C .shape [0 ] == 2 )
5417
+ if is_bivari :
5418
+ if cmap is None :
5419
+ cmap = mcolors .BivariateColormap ()
5420
+ if norm is None :
5421
+ norm = mcolors .BivariateNorm ()
5422
+
5416
5423
# unit conversion allows e.g. datetime objects as axis values
5417
5424
self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
5418
5425
X = self .convert_xunits (X )
@@ -5630,6 +5637,13 @@ def pcolormesh(self, *args, **kwargs):
5630
5637
X , Y , C = self ._pcolorargs ('pcolormesh' , * args , ** kw )
5631
5638
Ny , Nx = X .shape
5632
5639
5640
+ is_bivari = (C .ndim == 3 or C .shape [0 ] == 2 )
5641
+ if is_bivari :
5642
+ if cmap is None :
5643
+ cmap = mcolors .BivariateColormap ()
5644
+ if norm is None :
5645
+ norm = mcolors .BivariateNorm ()
5646
+
5633
5647
# unit conversion allows e.g. datetime objects as axis values
5634
5648
self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
5635
5649
X = self .convert_xunits (X )
@@ -5783,9 +5797,12 @@ def pcolorfast(self, *args, **kwargs):
5783
5797
5784
5798
C = np .asarray (args [- 1 ])
5785
5799
5786
- is_bivari = (isinstance (norm , mcolors .BivariateNorm ) or
5787
- isinstance (cmap , mcolors .BivariateColormap ))
5788
- if (C .ndim == 3 and is_bivari ):
5800
+ is_bivari = (C .ndim == 3 or C .shape [0 ] == 2 )
5801
+ if is_bivari :
5802
+ if cmap is None :
5803
+ cmap = mcolors .BivariateColormap ()
5804
+ if norm is None :
5805
+ norm = mcolors .BivariateNorm ()
5789
5806
nr , nc = C .shape [1 :]
5790
5807
else :
5791
5808
nr , nc = C .shape
0 commit comments