@@ -5150,6 +5150,13 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
51505150 "'mcolors.BivariateNorm'" )
51515151 raise ValueError (msg )
51525152
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+
51535160 if aspect is None :
51545161 aspect = rcParams ['image.aspect' ]
51555162 self .set_aspect (aspect )
@@ -5194,17 +5201,11 @@ def _pcolorargs(funcname, *args, **kw):
51945201 allmatch = kw .pop ("allmatch" , False )
51955202 norm = kw .pop ("norm" , None )
51965203 cmap = kw .pop ("cmap" , None )
5197- alpha = kw .pop ("alpha" , 1 )
51985204
51995205 if len (args ) == 1 :
52005206 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 :
52085209 numRows , numCols = C .shape [1 :]
52095210 else :
52105211 numRows , numCols = C .shape
@@ -5218,9 +5219,8 @@ def _pcolorargs(funcname, *args, **kw):
52185219
52195220 if len (args ) == 3 :
52205221 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 :
52245224 if cmap is None :
52255225 cmap = mcolors .BivariateColormap ()
52265226 if norm is None :
@@ -5413,6 +5413,13 @@ def pcolor(self, *args, **kwargs):
54135413 X , Y , C = self ._pcolorargs ('pcolor' , * args , ** kw )
54145414 Ny , Nx = X .shape
54155415
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+
54165423 # unit conversion allows e.g. datetime objects as axis values
54175424 self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
54185425 X = self .convert_xunits (X )
@@ -5630,6 +5637,13 @@ def pcolormesh(self, *args, **kwargs):
56305637 X , Y , C = self ._pcolorargs ('pcolormesh' , * args , ** kw )
56315638 Ny , Nx = X .shape
56325639
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+
56335647 # unit conversion allows e.g. datetime objects as axis values
56345648 self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
56355649 X = self .convert_xunits (X )
@@ -5783,9 +5797,12 @@ def pcolorfast(self, *args, **kwargs):
57835797
57845798 C = np .asarray (args [- 1 ])
57855799
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 ()
57895806 nr , nc = C .shape [1 :]
57905807 else :
57915808 nr , nc = C .shape
0 commit comments