You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ENH]: rgp or rgba option for pyplot pcolormesh and/or pcolor #24418
The axis argument X and Y in pcolormesh allows to have non-equidistantly spaced data grids which is very useful if you have measured/simulated/etc data on non-simple axes.
imshow on the other hands does not support such non-equidistant axes since the change to version 2. However, it support the use of (N, M, 3) or (N, M, 4) dimensional arrays to encode rgp or rgba data directly. This allows to write routines that encode e.g. 2D dimensional information like (orientation in color, strength in darkness) or 3D date (directly mapped to rgb).
There seems no way to combine both non-equidistant aces and rgb(a) support in matplotlib.
Proposed solution
Would it be possible to add the rgb and rgba options to pcolormesh/pcolor as well?
Or are there other options for tackling this issue?
Is there actual interest in such an option and would it be worth to add code fo it?
Activity
jklymak commentedon Nov 10, 2022
Note that you can set
facecolors: https://stackoverflow.com/questions/70541279/how-to-pcolormesh-rgba-array-with-2d-x-and-y.OTOH, this is a bit silly, and I agree that if we have a 3-D array, we should bypass colormapping and use the colors.
PrometheusPi commentedon Nov 11, 2022
Thanks a lot @jklymak, the suggested example from stackoverflow works like a charm.
Also thanks you for your comment, that you agree that having support for 3D arrays in
pcolormeshseems useful or at least consistent withimshow.