Skip to content
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

Applying different color maps to 2d array #21

Open
vguillet opened this issue May 27, 2020 · 1 comment
Open

Applying different color maps to 2d array #21

vguillet opened this issue May 27, 2020 · 1 comment

Comments

@vguillet
Copy link

Good afternoon,

I was wondering is it was possible to convert a 2d numpy array to a Pixmap with a colour gradient (similar to numpy's colorbar method) instead of a gray?

Thank you!

@hmeine
Copy link
Owner

hmeine commented Apr 16, 2021

This functionality is not available yet, and I am not 100% sure if it should be. The current scope of qimage2ndarray is to be able to convert from ndarrays to QImage and back, with a few helper functions allowing to load/save or scale grayvalues.

I believe the latter is where you're coming from – it may appear as if qimage2ndarray intends to do the mapping from arbitrary values to QImage as well. On the one hand, I could imagine that a simple interface with matplotlib for instance might make sense – if array2qimage would accept a cmap parameter for instance and then make use of a matplotlib colormap function. On the other hand, I hesitate a little, because I wonder if this would be feature creep? Would people then ask to also have non-MPL colormaps included to get rid of the dependency? Would people eventually require even more ways to influence the mapping?

I honestly value your and others' opinions. (And should have picked up the discussion earlier, sorry about the delay.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants