@@ -5182,8 +5182,9 @@ def _pcolorargs(funcname, *args, **kw):
51825182 cmap = mcolors .BivariateColormap ()
51835183 if norm is None :
51845184 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
51875188 if allmatch :
51885189 X , Y = np .meshgrid (np .arange (numCols ), np .arange (numRows ))
51895190 else :
@@ -5201,8 +5202,9 @@ def _pcolorargs(funcname, *args, **kw):
52015202 cmap = mcolors .BivariateColormap ()
52025203 if norm is None :
52035204 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
52065208 else :
52075209 raise TypeError (
52085210 'Illegal arguments to %s; see help(%s)' % (funcname , funcname ))
@@ -5599,25 +5601,25 @@ def pcolormesh(self, *args, **kwargs):
55995601 X , Y , C = self ._pcolorargs ('pcolormesh' , * args , ** kw )
56005602 Ny , Nx = X .shape
56015603
5602- if (isinstance (norm , mcolors .BivariateNorm ) or
5603- isinstance (cmap , mcolors .BivariateColormap )):
5604- norm = mcolors .NoNorm ()
5605-
56065604 # unit conversion allows e.g. datetime objects as axis values
56075605 self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
56085606 X = self .convert_xunits (X )
56095607 Y = self .convert_yunits (Y )
56105608
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+
56135615 coords = np .column_stack ((X .flat , Y .flat )).astype (float , copy = False )
56145616
56155617 collection = mcoll .QuadMesh (Nx - 1 , Ny - 1 , coords ,
56165618 antialiased = antialiased , shading = shading ,
56175619 ** kwargs )
56185620 collection .set_alpha (alpha )
56195621 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 ):
56215623 msg = "'norm' must be an instance of 'mcolors.Normalize'"
56225624 raise ValueError (msg )
56235625 collection .set_cmap (cmap )
0 commit comments