@@ -6175,6 +6175,7 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None,
61756175 - (M, N): an image with scalar data. The values are mapped to
61766176 colors using normalization and a colormap. See parameters *norm*,
61776177 *cmap*, *vmin*, *vmax*.
6178+ - (v, M, N): if coupled with a cmap that supports v scalars
61786179 - (M, N, 3): an image with RGB values (0-1 float or 0-255 int).
61796180 - (M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
61806181 i.e. including transparency.
@@ -6184,15 +6185,16 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None,
61846185
61856186 Out-of-range RGB(A) values are clipped.
61866187
6187- %(cmap_doc)s
6188+
6189+ %(multi_cmap_doc)s
61886190
61896191 This parameter is ignored if *X* is RGB(A).
61906192
6191- %(norm_doc )s
6193+ %(multi_norm_doc )s
61926194
61936195 This parameter is ignored if *X* is RGB(A).
61946196
6195- %(vmin_vmax_doc )s
6197+ %(multi_vmin_vmax_doc )s
61966198
61976199 This parameter is ignored if *X* is RGB(A).
61986200
@@ -6271,6 +6273,9 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None,
62716273 See :doc:`/gallery/images_contours_and_fields/image_antialiasing` for
62726274 a discussion of image antialiasing.
62736275
6276+ Only 'data' is available when using `~matplotlib.colors.BivarColormap`
6277+ or `~matplotlib.colors.MultivarColormap`
6278+
62746279 alpha : float or array-like, optional
62756280 The alpha blending value, between 0 (transparent) and 1 (opaque).
62766281 If *alpha* is an array, the alpha blending values are applied pixel
@@ -6376,6 +6381,7 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None,
63766381 if aspect is not None :
63776382 self .set_aspect (aspect )
63786383
6384+ X = mcolorizer ._ensure_multivariate_data (X , im .norm .n_components )
63796385 im .set_data (X )
63806386 im .set_alpha (alpha )
63816387 if im .get_clip_path () is None :
@@ -6531,9 +6537,10 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
65316537
65326538 Parameters
65336539 ----------
6534- C : 2D array-like
6540+ C : 2D or 3D array-like
65356541 The color-mapped values. Color-mapping is controlled by *cmap*,
6536- *norm*, *vmin*, and *vmax*.
6542+ *norm*, *vmin*, and *vmax*. 3D arrays are supported only if the
6543+ cmap supports v channels, where v is the size along the first axis.
65376544
65386545 X, Y : array-like, optional
65396546 The coordinates of the corners of quadrilaterals of a pcolormesh::
@@ -6578,11 +6585,11 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
65786585 See :doc:`/gallery/images_contours_and_fields/pcolormesh_grids`
65796586 for more description.
65806587
6581- %(cmap_doc )s
6588+ %(multi_cmap_doc )s
65826589
6583- %(norm_doc )s
6590+ %(multi_norm_doc )s
65846591
6585- %(vmin_vmax_doc )s
6592+ %(multi_vmin_vmax_doc )s
65866593
65876594 %(colorizer_doc)s
65886595
@@ -6657,8 +6664,17 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
66576664 if shading is None :
66586665 shading = mpl .rcParams ['pcolor.shading' ]
66596666 shading = shading .lower ()
6660- X , Y , C , shading = self ._pcolorargs ('pcolor' , * args , shading = shading ,
6661- kwargs = kwargs )
6667+
6668+ if colorizer is None :
6669+ cmap = mcolorizer ._ensure_cmap (cmap , accept_multivariate = True )
6670+ C = mcolorizer ._ensure_multivariate_data (args [- 1 ], cmap .n_variates )
6671+ else :
6672+ C = mcolorizer ._ensure_multivariate_data (args [- 1 ],
6673+ colorizer .cmap .n_variates )
6674+
6675+ X , Y , C , shading = self ._pcolorargs ('pcolor' , * args [:- 1 ], C ,
6676+ shading = shading , kwargs = kwargs )
6677+
66626678 linewidths = (0.25 ,)
66636679 if 'linewidth' in kwargs :
66646680 kwargs ['linewidths' ] = kwargs .pop ('linewidth' )
@@ -6733,6 +6749,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
67336749 - (M, N) or M*N: a mesh with scalar data. The values are mapped to
67346750 colors using normalization and a colormap. See parameters *norm*,
67356751 *cmap*, *vmin*, *vmax*.
6752+ - (v, M, N): if coupled with a cmap that supports v scalars
67366753 - (M, N, 3): an image with RGB values (0-1 float or 0-255 int).
67376754 - (M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
67386755 i.e. including transparency.
@@ -6767,11 +6784,11 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
67676784 expanded as needed into the appropriate 2D arrays, making a
67686785 rectangular grid.
67696786
6770- %(cmap_doc )s
6787+ %(multi_cmap_doc )s
67716788
6772- %(norm_doc )s
6789+ %(multi_norm_doc )s
67736790
6774- %(vmin_vmax_doc )s
6791+ %(multi_vmin_vmax_doc )s
67756792
67766793 %(colorizer_doc)s
67776794
@@ -6897,7 +6914,15 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
68976914 shading = mpl ._val_or_rc (shading , 'pcolor.shading' ).lower ()
68986915 kwargs .setdefault ('edgecolors' , 'none' )
68996916
6900- X , Y , C , shading = self ._pcolorargs ('pcolormesh' , * args ,
6917+ if colorizer is None :
6918+ cmap = mcolorizer ._ensure_cmap (cmap , accept_multivariate = True )
6919+ C = mcolorizer ._ensure_multivariate_data (args [- 1 ], cmap .n_variates )
6920+ else :
6921+ C = mcolorizer ._ensure_multivariate_data (args [- 1 ],
6922+ colorizer .cmap .n_variates )
6923+
6924+
6925+ X , Y , C , shading = self ._pcolorargs ('pcolormesh' , * args [:- 1 ], C ,
69016926 shading = shading , kwargs = kwargs )
69026927 coords = np .stack ([X , Y ], axis = - 1 )
69036928
0 commit comments