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
The current implementation of colormaps maps a 1D float interval onto a 1D color spectrum. Meaning, I can use a colormap to find the color that 'matches' a single float value.
Sometimes, however, I'd like to get the color that matches a pair or triplet of float values.
A use case: coloring locations on a city map, where the color for each location is calculated from 2 values: the time needed to get there by car, and the time needed to get there by public transport. Or, from 3 values, if the time needed to get there by bike is also included. In that case, the color could be picked from a color triangle like this one.
Now, please note I've only created this for myself and probably needs a lot of work to be able to get merged into matplotlib. For example, there is no unit tests whatsoever.
Proposed Way Forward
A core developer has a look a the linked project to check out, what I mean, and to judge if this is something the matplotlib package would actually benefit from including. (The examples at the ends of the sections ColorMap2 and ColorMap3 in the readme are the best places to start to get an idea of what I mean.)
If yes, someone probably has some suggestions regarding how to start on a PR for this feature. I'd gladly help to get this included into the project, but my coding skills are insufficient to do this without by myself.
But let's first see if this is deemed of interest. :)
@rwijtvliet Thanks for the proposal! I see where this is useful.
Mapping multiple values to a color is a rather specialized application. Given the vast scope of visualization, we try to keep Matplotlib focused on core features to keep it manageable. The proposed way forward here is to create a third-party package. This also has the advantage, that you can move the development at your own pace independent of the Matplotlib release cycle.
If a separate project is too big, it's also possible to add code as an example. Though it seems one needs quite a bit of code, which could make the example hard to read.
Hey guys, thanks for the feedback, much appreciated.
#8738 is similar in accepting >1 float, but different in not returning a color based on the relative difference (i.e., it accepts quantities with unequal physical units). But I'm sure I can learn a lot from that code.
I'll see what the best way to go about things is here and start with posting an example. @timhoffm, you included a link to the examples page, but I'm not immediately seeing a way to add my own example. Am I missing something?
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Activity
timhoffm commentedon Oct 26, 2020
@rwijtvliet Thanks for the proposal! I see where this is useful.
Mapping multiple values to a color is a rather specialized application. Given the vast scope of visualization, we try to keep Matplotlib focused on core features to keep it manageable. The proposed way forward here is to create a third-party package. This also has the advantage, that you can move the development at your own pace independent of the Matplotlib release cycle.
We'd be happy to include such a package in https://matplotlib.org/thirdpartypackages/index.html. If there's interest, there's also the possibility to host third-party repositories under the Matplotlib GitHub Project.
If a separate project is too big, it's also possible to add code as an example. Though it seems one needs quite a bit of code, which could make the example hard to read.
tacaswell commentedon Oct 26, 2020
We also had a GSOC student take a pass at this 3 years but it ended up not being merged (yet): #8738 .
The examples in the README are pretty nifty @rwijtvliet :)
I suggest having a look at https://github.com/NSLS-II/scientific-python-cookiecutter / https://nsls-ii.github.io/scientific-python-cookiecutter/ for how to bootstrap the code you have into a full package.
ianhi commentedon Oct 27, 2020
There's also a list of pieces of info I thought might helpful when making a 3rd party packages here: #18496
rwijtvliet commentedon Oct 28, 2020
Hey guys, thanks for the feedback, much appreciated.
#8738 is similar in accepting >1 float, but different in not returning a color based on the relative difference (i.e., it accepts quantities with unequal physical units). But I'm sure I can learn a lot from that code.
I'll see what the best way to go about things is here and start with posting an example. @timhoffm, you included a link to the examples page, but I'm not immediately seeing a way to add my own example. Am I missing something?
jklymak commentedon Oct 28, 2020
@rwijtvliet You add an example by adding python code in
examples/timhoffm commentedon Oct 29, 2020
See also https://matplotlib.org/devel/documenting_mpl.html#writing-examples-and-tutorials
github-actions commentedon Sep 1, 2023
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
jklymak commentedon Sep 1, 2023
This is basically #14168, so lets close this...