-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
ENH: Add newly proposed colormaps #4707
Conversation
hurray! |
Thank you! |
'pink', | ||
'prism', | ||
'spring', | ||
'summer', | ||
'sunset', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage of "sunrise" over "sunset" is that the map goes from dark to light; but maybe one of the other naming schemes will override all this anyway. (Also, "sunrise" has a more upbeat, optimistic feel...)
I am in favor of making one of the 'rocket' 🚀 per @mwaskom |
@@ -1971,12 +1971,16 @@ def colormaps(): | |||
by changing the hue component in the HSV color space | |||
jet a spectral map with dark endpoints, blue-cyan-yellow-red; | |||
based on a fluid-jet simulation by NCSA [#]_ | |||
neoncity perceptually uniform shares of blue-red-yellow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"shares" --> "shades"
@efiring Can you be in charge of the naming issues on our side? Hopefully this thread stays calmer than the skimage thread. |
OK; but just as there was no agreement among those polled about the virtues of A, B, and C, I expect virtually no agreement about how to name A, B, and C. We'll work it out, though. |
I am fine with the names as-is.
|
The only vague agreement I could sense in the other thread was for 'rocket'. Shall I replace viola with rocket? |
@stefanv, I'm going to make a strong recommendation, with my rationale. If you or Nathaniel are strongly opposed, then I will defer to you; otherwise, I hope my recommendation will prove in the long run to be a satisfactory way to get the paint on the bikeshed and move on. I expect my recommendation will disappoint and/or annoy most of the people who have weighed in on this topic, but so be it. General criteria for most non-default colormaps:
Starting with (1), the viable candidates are related to fire (I will put "rocket" in this category), magma, and sunrise/sunset. All of these can have some near-black, all can have some very light yellows, and some reds and orange tones. The problem with the first two of these is that I don't think they have magenta shades, which are prominent in A, B, and C. To my eye, the sunrise/sunset names are by far the closest to the actual shades in the maps. Sunrise has the additional advantage of going in the right direction, dark to light. (2) eliminates suggestions like "softsunrise". (3) with (2) favors the use of numbers to distinguish subtle variations. My recommendation:
I gave B the priority of having no number because I think it is (by a whisker) the best default of the group: C is too blue, A lacks contrast with a white background at the high end. |
My personal favorite is still this: scikit-image/scikit-image#1599 (comment) |
@stefanv: just on the off chance you've been waiting to catch me at the
|
@efiring Is this the most optimal way of representing the colormap values? I put a very large table in there, but I can also do it differently (I just followed what was in the file already). I'll chat to Nathaniel and figure out what to do with the naming |
Short answer: please use your list of rgb values to initialize a ListedColormap; and ideally, reduce the number of digits printed out in the list. @stefanv, in fact I don't like the way that _cm.py has ballooned even before this PR. I think the LinearSegmentedColormap initialization via dictionaries for r, g, and b is highly inefficient and awkward for all of the maps that are being specified with a large number of points. The specification can be cut down to 33% simply by feeding the rgb values into the |
So looking at the code to make sure I understand what you mean -- it looks like |
@njsmith, yes, exactly. |
The travis failure is in the doc build, and is unrelated. |
Eric, I gave it a shot--let me know what you think. Happy to rework as necessary. |
@@ -1971,12 +1971,16 @@ def colormaps(): | |||
by changing the hue component in the HSV color space | |||
jet a spectral map with dark endpoints, blue-cyan-yellow-red; | |||
based on a fluid-jet simulation by NCSA [#]_ | |||
neoncity perceptually uniform shades of blue-red-yellow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that updating the names in this docstring is the last thing remaining.
Good catch! |
PEP8 is being pesky as usual. It is unhappy about the space after each '[' and before each ']'. |
Updated to fix spacing |
Github's presentation of what has passed and what has failed has been changed recently, and the new version is self-contradictory, with two inconsistent statements, both of which are wrong. In any case, looking at Travis, there are two failures. One failure is the typical false alarm (random glitch associated with LaTeX), but pep8 still has one complaint: in _cm_listed.py, it wants all imports to be at the top of the file. Sorry I missed that the last time. |
grumble I passed this through flake8 beforehand--which checker do you use? |
OK, let's try again!
|
pep8 testing is done with the pep8 module, invoked in lib/matplotlib/tests/test_coding_standards.py. That, in turn, can be invoked from the tests.py script in the base directory, or via
|
ENH: Add newly proposed colormaps
I don't know why github says a check failed; I looked at the travis page, and everything was green. In any case, the 4 new maps are now in place. Thanks very much for all the work you and @njsmith have done leading up to this. |
Hah, interesting--this update was made to the PEP8 checker since my last install (a few months ago). Thanks for the explanation and the reviews, Eric! |
|
||
# This function was autogenerated by boilerplate.py. Do not edit as | ||
# changes will be lost | ||
def magma(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought these functions were not supposed to be created any longer? The originals were only included for Matlab compatibility, and all other colormaps should be set with set_cmap('magma')
?
See #889 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are auto generated so all that is done here is to regenerate pyplot with boilerplate.py
If you want to change that I suggest raising a new issue.
Should all the ColorBrewer maps be converted to ListedColormap based on the original values from the spreadsheet, then? (Defined using 12 points per colormap at most.)
Should it interpolate in a perceptual space instead? |
Is it true that the plot used in the new paper of the gravitational field used the color map added in this PR ? It looks so, doesn't it? |
Yes. The tutorial demonstrates it here: https://losc.ligo.org/s/events/GW150914/GW150914_tutorial.html. |
Yes, the LSC has been pretty good early adopters of the new defaults for Independent of colour maps, a significant fraction of the figures in this Duncan On 12 February 2016 at 01:39, Phil Elson notifications@github.com wrote:
Duncan Macleod |
This PR adds four new color maps to matplotlib, including the newly proposed default
viridis
.The colormaps are currently specified by 256 data values.