Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ENH]: rgp or rgba option for pyplot pcolormesh and/or pcolor #24418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PrometheusPi opened this issue Nov 10, 2022 · 2 comments · Fixed by #24619
Closed

[ENH]: rgp or rgba option for pyplot pcolormesh and/or pcolor #24418

PrometheusPi opened this issue Nov 10, 2022 · 2 comments · Fixed by #24619
Milestone

Comments

@PrometheusPi
Copy link

Problem

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?

@jklymak
Copy link
Member

jklymak commented 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
Copy link
Author

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 pcolormesh seems useful or at least consistent with imshow.

@QuLogic QuLogic added this to the v3.7.0 milestone Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants