diff --git a/doc/api/api_changes/2017-06-08-PGE.rst b/doc/api/api_changes/2017-06-08-PGE.rst new file mode 100644 index 00000000000..e7bf2b8004b --- /dev/null +++ b/doc/api/api_changes/2017-06-08-PGE.rst @@ -0,0 +1,4 @@ +Added support for RGB(A) images in pcolorfast +````````````````````````````````````````````` + +pcolorfast now excepts 3D images (x,y,color) as inputs in `C` if they qualify for pcolorimage or image diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index e1e1a3d1844..18c4456b751 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -5602,6 +5602,10 @@ def pcolorfast(self, *args, **kwargs): C is the 2D array of color values corresponding to quadrilateral cells. Let (nr, nc) be its shape. C may be a masked array. + C can in some cases be 3D with the last dimension as rgb(a). + This is available when C qualifies for image or pcolorimage type, + will throw a TyepError if C is 3D and quadmesh + ``ax.pcolorfast(C, **kwargs)`` is equivalent to ``ax.pcolorfast([0,nc], [0,nr], C, **kwargs)`` @@ -5677,7 +5681,7 @@ def pcolorfast(self, *args, **kwargs): raise ValueError(msg) C = args[-1] - nr, nc = C.shape + nr, nc = C.shape[:2] if len(args) == 1: style = "image" x = [0, nc] @@ -5698,6 +5702,10 @@ def pcolorfast(self, *args, **kwargs): else: style = "pcolorimage" elif x.ndim == 2 and y.ndim == 2: + if C.ndim > 2: + raise TypeError(''' + Pcolorfast needs to use quadmesh, but C has more then 2 dimensions. + Is it an RGB(A) image?''') style = "quadmesh" else: raise TypeError("arguments do not match valid signatures")