@@ -5200,8 +5200,9 @@ def _pcolorargs(funcname, *args, **kw):
5200
5200
cmap = mcolors .BivariateColormap ()
5201
5201
if norm is None :
5202
5202
norm = mcolors .BivariateNorm ()
5203
- C = norm (C )
5204
- numRows , numCols = C .shape
5203
+ numRows , numCols = C .shape [1 :]
5204
+ else :
5205
+ numRows , numCols = C .shape
5205
5206
if allmatch :
5206
5207
X , Y = np .meshgrid (np .arange (numCols ), np .arange (numRows ))
5207
5208
else :
@@ -5219,8 +5220,9 @@ def _pcolorargs(funcname, *args, **kw):
5219
5220
cmap = mcolors .BivariateColormap ()
5220
5221
if norm is None :
5221
5222
norm = mcolors .BivariateNorm ()
5222
- C = norm (C )
5223
- numRows , numCols = C .shape
5223
+ numRows , numCols = C .shape [1 :]
5224
+ else :
5225
+ numRows , numCols = C .shape
5224
5226
else :
5225
5227
raise TypeError (
5226
5228
'Illegal arguments to %s; see help(%s)' % (funcname , funcname ))
@@ -5614,25 +5616,25 @@ def pcolormesh(self, *args, **kwargs):
5614
5616
X , Y , C = self ._pcolorargs ('pcolormesh' , * args , ** kw )
5615
5617
Ny , Nx = X .shape
5616
5618
5617
- if (isinstance (norm , mcolors .BivariateNorm ) or
5618
- isinstance (cmap , mcolors .BivariateColormap )):
5619
- norm = mcolors .NoNorm ()
5620
-
5621
5619
# unit conversion allows e.g. datetime objects as axis values
5622
5620
self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
5623
5621
X = self .convert_xunits (X )
5624
5622
Y = self .convert_yunits (Y )
5625
5623
5626
- # convert to one dimensional arrays
5627
- C = C .ravel ()
5624
+ # convert to one dimensional arrays if univariate
5625
+ if isinstance (norm , mcolors .BivariateNorm ):
5626
+ C = np .asarray ([C [0 ].ravel (), C [1 ].ravel ()])
5627
+ else :
5628
+ C = C .ravel ()
5629
+
5628
5630
coords = np .column_stack ((X .flat , Y .flat )).astype (float , copy = False )
5629
5631
5630
5632
collection = mcoll .QuadMesh (Nx - 1 , Ny - 1 , coords ,
5631
5633
antialiased = antialiased , shading = shading ,
5632
5634
** kwargs )
5633
5635
collection .set_alpha (alpha )
5634
5636
collection .set_array (C )
5635
- if norm is not None and not isinstance (norm , mcolors .Normalize ):
5637
+ if norm is not None and not isinstance (norm , mcolors .Norms ):
5636
5638
msg = "'norm' must be an instance of 'mcolors.Normalize'"
5637
5639
raise ValueError (msg )
5638
5640
collection .set_cmap (cmap )
0 commit comments