@@ -6060,6 +6060,7 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None,
60606060 - (M, N): an image with scalar data. The values are mapped to
60616061 colors using normalization and a colormap. See parameters *norm*,
60626062 *cmap*, *vmin*, *vmax*.
6063+ - (v, M, N): if coupled with a cmap that supports v scalars
60636064 - (M, N, 3): an image with RGB values (0-1 float or 0-255 int).
60646065 - (M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
60656066 i.e. including transparency.
@@ -6069,15 +6070,16 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None,
60696070
60706071 Out-of-range RGB(A) values are clipped.
60716072
6072- %(cmap_doc)s
6073+
6074+ %(multi_cmap_doc)s
60736075
60746076 This parameter is ignored if *X* is RGB(A).
60756077
6076- %(norm_doc )s
6078+ %(multi_norm_doc )s
60776079
60786080 This parameter is ignored if *X* is RGB(A).
60796081
6080- %(vmin_vmax_doc )s
6082+ %(multi_vmin_vmax_doc )s
60816083
60826084 This parameter is ignored if *X* is RGB(A).
60836085
@@ -6156,6 +6158,9 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None,
61566158 See :doc:`/gallery/images_contours_and_fields/image_antialiasing` for
61576159 a discussion of image antialiasing.
61586160
6161+ Only 'data' is available when using `~matplotlib.colors.BivarColormap`
6162+ or `~matplotlib.colors.MultivarColormap`
6163+
61596164 alpha : float or array-like, optional
61606165 The alpha blending value, between 0 (transparent) and 1 (opaque).
61616166 If *alpha* is an array, the alpha blending values are applied pixel
@@ -6261,6 +6266,7 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None,
62616266 if aspect is not None :
62626267 self .set_aspect (aspect )
62636268
6269+ X = mcolorizer ._ensure_multivariate_data (X , im .norm .n_components )
62646270 im .set_data (X )
62656271 im .set_alpha (alpha )
62666272 if im .get_clip_path () is None :
@@ -6416,9 +6422,10 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
64166422
64176423 Parameters
64186424 ----------
6419- C : 2D array-like
6425+ C : 2D or 3D array-like
64206426 The color-mapped values. Color-mapping is controlled by *cmap*,
6421- *norm*, *vmin*, and *vmax*.
6427+ *norm*, *vmin*, and *vmax*. 3D arrays are supported only if the
6428+ cmap supports v channels, where v is the size along the first axis.
64226429
64236430 X, Y : array-like, optional
64246431 The coordinates of the corners of quadrilaterals of a pcolormesh::
@@ -6465,11 +6472,11 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
64656472 See :doc:`/gallery/images_contours_and_fields/pcolormesh_grids`
64666473 for more description.
64676474
6468- %(cmap_doc )s
6475+ %(multi_cmap_doc )s
64696476
6470- %(norm_doc )s
6477+ %(multi_norm_doc )s
64716478
6472- %(vmin_vmax_doc )s
6479+ %(multi_vmin_vmax_doc )s
64736480
64746481 %(colorizer_doc)s
64756482
@@ -6544,8 +6551,17 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
65446551 if shading is None :
65456552 shading = mpl .rcParams ['pcolor.shading' ]
65466553 shading = shading .lower ()
6547- X , Y , C , shading = self ._pcolorargs ('pcolor' , * args , shading = shading ,
6548- kwargs = kwargs )
6554+
6555+ if colorizer is None :
6556+ cmap = mcolorizer ._ensure_cmap (cmap , accept_multivariate = True )
6557+ C = mcolorizer ._ensure_multivariate_data (args [- 1 ], cmap .n_variates )
6558+ else :
6559+ C = mcolorizer ._ensure_multivariate_data (args [- 1 ],
6560+ colorizer .cmap .n_variates )
6561+
6562+ X , Y , C , shading = self ._pcolorargs ('pcolor' , * args [:- 1 ], C ,
6563+ shading = shading , kwargs = kwargs )
6564+
65496565 linewidths = (0.25 ,)
65506566 if 'linewidth' in kwargs :
65516567 kwargs ['linewidths' ] = kwargs .pop ('linewidth' )
@@ -6620,6 +6636,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
66206636 - (M, N) or M*N: a mesh with scalar data. The values are mapped to
66216637 colors using normalization and a colormap. See parameters *norm*,
66226638 *cmap*, *vmin*, *vmax*.
6639+ - (v, M, N): if coupled with a cmap that supports v scalars
66236640 - (M, N, 3): an image with RGB values (0-1 float or 0-255 int).
66246641 - (M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
66256642 i.e. including transparency.
@@ -6656,11 +6673,11 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
66566673 expanded as needed into the appropriate 2D arrays, making a
66576674 rectangular grid.
66586675
6659- %(cmap_doc )s
6676+ %(multi_cmap_doc )s
66606677
6661- %(norm_doc )s
6678+ %(multi_norm_doc )s
66626679
6663- %(vmin_vmax_doc )s
6680+ %(multi_vmin_vmax_doc )s
66646681
66656682 %(colorizer_doc)s
66666683
@@ -6783,7 +6800,15 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
67836800 shading = mpl ._val_or_rc (shading , 'pcolor.shading' ).lower ()
67846801 kwargs .setdefault ('edgecolors' , 'none' )
67856802
6786- X , Y , C , shading = self ._pcolorargs ('pcolormesh' , * args ,
6803+ if colorizer is None :
6804+ cmap = mcolorizer ._ensure_cmap (cmap , accept_multivariate = True )
6805+ C = mcolorizer ._ensure_multivariate_data (args [- 1 ], cmap .n_variates )
6806+ else :
6807+ C = mcolorizer ._ensure_multivariate_data (args [- 1 ],
6808+ colorizer .cmap .n_variates )
6809+
6810+
6811+ X , Y , C , shading = self ._pcolorargs ('pcolormesh' , * args [:- 1 ], C ,
67876812 shading = shading , kwargs = kwargs )
67886813 coords = np .stack ([X , Y ], axis = - 1 )
67896814
0 commit comments