@@ -5182,8 +5182,9 @@ def _pcolorargs(funcname, *args, **kw):
5182
5182
cmap = mcolors .BivariateColormap ()
5183
5183
if norm is None :
5184
5184
norm = mcolors .BivariateNorm ()
5185
- C = norm (C )
5186
- numRows , numCols = C .shape
5185
+ numRows , numCols = C .shape [1 :]
5186
+ else :
5187
+ numRows , numCols = C .shape
5187
5188
if allmatch :
5188
5189
X , Y = np .meshgrid (np .arange (numCols ), np .arange (numRows ))
5189
5190
else :
@@ -5201,8 +5202,9 @@ def _pcolorargs(funcname, *args, **kw):
5201
5202
cmap = mcolors .BivariateColormap ()
5202
5203
if norm is None :
5203
5204
norm = mcolors .BivariateNorm ()
5204
- C = norm (C )
5205
- numRows , numCols = C .shape
5205
+ numRows , numCols = C .shape [1 :]
5206
+ else :
5207
+ numRows , numCols = C .shape
5206
5208
else :
5207
5209
raise TypeError (
5208
5210
'Illegal arguments to %s; see help(%s)' % (funcname , funcname ))
@@ -5599,25 +5601,25 @@ def pcolormesh(self, *args, **kwargs):
5599
5601
X , Y , C = self ._pcolorargs ('pcolormesh' , * args , ** kw )
5600
5602
Ny , Nx = X .shape
5601
5603
5602
- if (isinstance (norm , mcolors .BivariateNorm ) or
5603
- isinstance (cmap , mcolors .BivariateColormap )):
5604
- norm = mcolors .NoNorm ()
5605
-
5606
5604
# unit conversion allows e.g. datetime objects as axis values
5607
5605
self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
5608
5606
X = self .convert_xunits (X )
5609
5607
Y = self .convert_yunits (Y )
5610
5608
5611
- # convert to one dimensional arrays
5612
- C = C .ravel ()
5609
+ # convert to one dimensional arrays if univariate
5610
+ if isinstance (norm , mcolors .BivariateNorm ):
5611
+ C = np .asarray ([C [0 ].ravel (), C [1 ].ravel ()])
5612
+ else :
5613
+ C = C .ravel ()
5614
+
5613
5615
coords = np .column_stack ((X .flat , Y .flat )).astype (float , copy = False )
5614
5616
5615
5617
collection = mcoll .QuadMesh (Nx - 1 , Ny - 1 , coords ,
5616
5618
antialiased = antialiased , shading = shading ,
5617
5619
** kwargs )
5618
5620
collection .set_alpha (alpha )
5619
5621
collection .set_array (C )
5620
- if norm is not None and not isinstance (norm , mcolors .Normalize ):
5622
+ if norm is not None and not isinstance (norm , mcolors .Norms ):
5621
5623
msg = "'norm' must be an instance of 'mcolors.Normalize'"
5622
5624
raise ValueError (msg )
5623
5625
collection .set_cmap (cmap )
0 commit comments