-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Adding names to the color in the new (Vega) default color cycle #7248
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
Comments
Can not hurt, but we should make sure there is not an existing set of names for them. I am pretty 😐 on this. |
I think that's a good idea |
@NelleV Can the machine shop do this? :) |
The machine shop sure can! |
Doing the literature search suggested by @tacaswell (check whether they already have standard names) is also part of the assignment, hehe... |
Not sure if I can use names from these references and try to match the color in vega cycle with those name using my naked eyes. Or any better way to do that? https://xkcd.com/color/rgb/ Also, something like: 'vega:steelblue' (for #1f77b4 ), 'vega:sienna' or 'vega:saddlebrown'( for #8c564b ) is hard to remember and long? |
It'd be easier to find names if we had a way to see all colors that need to be named. |
Updated OP with link to the Vega palettes. I think that because these will be the default colors, we should stick to relatively short names. As a side note, http://matplotlib.org/devdocs/examples/color/named_colors.html should be updated (I guess we'll have a new VEGA_COLORS dict). It may also make sense to sort the colors first by "category" in that plot (1. one-letter, 2. Vega, 3. CSS). |
If I am not mistaken, it is only the first ten. There are only two redundant color (blue and green) so it should be quite straightforward |
We should probably consult @jheer on these names (I have also sent him a private email, but he is out on paternity leave this semester). It is probably worth tracking down one of his students? |
Also, this is tagged 'Easy', but naming thing is one of the two hard problems in CS:
|
@trpham using a computer rather than by-eye to find closest match sounds like a solvable problem, just minimising the error. def hexcolor_to_rgb(color):
np.array([int(color[i:i+2], 16) for i in [1,3,5]])
our_color = hexcolor_to_rgb(our_c)
lowest_ms = np.inf
color_info = None
for color in list_of_their_colors:
their_color = hexcolor_to_rgb(color)
ms = ((their_color - our_color)**2).sum() # find the entry
if ms < lowest_ms:
lowest_ms = ms
color_info = their_color That said, I think the "ms = " line needs to change to an algorithm more suited to colour as afaik rgb space doesn't work linearly. Others in this group can give a better formula for this. Good though as an initial approximation. |
I don't think we should try to match "fancy" names to these colours (like steelblue or saddlebrown). The vega: prefix seems like a good enough differentiator, and I think picking the simplest name to go along with it is best. |
Should the prefix be |
vega20 is just vega10 with lighter variants, so we could just have vega:blue, vega:lightblue, vega:red, vega:lightred and so on. I'd rather keep the names of the colors in the new default cycle as short as possible. |
I don't see why we need different names like that as we have namespaced the colours... Maybe aliasing becomes an option? So we have This way it allows people to search for colours, the concept behind xkcd colour naming came because people wanted to search for colours and so colours needed a description to easily find that colour. Perhaps though this goes overboard for matplotlib... |
That's why I'm suggesting folding vega10 and vega20 into the same "vega:" namespace. If you look at how vega20b/c are arranged, they are made of quadruplets of variants of the same color, thus the blue{1,2,3,4} suggestion. (Also I don't think "orchid" is really helpful as a name for a default color.) |
Also trying @domoritz to get some input from the vega folks. |
The color palette in vega is actually just the d3 color palette, which in turn is the original Tableau 10 color palette. Tableau recently updated the color palette as they described in a blog post: https://www.tableau.com/about/blog/2016/7/colors-upgrade-tableau-10-56782. I think you should talk to Maureen Stone about the color names. |
I seem to recall that some time ago there was a proposal to add a tableau color palette to mpl, but they were deemed to be proprietary so we did not proceed. Am I remembering incorrectly, or has something changed in the interim? |
That was #3700 and I'm not sure it was ever resolved. |
vega, vega-light, and d3 are all BSD 3-clause, if there are IP issues, we are in a pretty big boat! |
That said, vega and d3 don't exist in the repos for distros like debian and they will no doubt take a hard line on this rather than just hope for the best. |
@QuLogic is absolutely correct -- keep it simple, and it's mostly obviou swhat is simple from the names pasted by @trpham: red, not crimson That last on it not as obvious though -- but, "turquoise" is too long and hard to spell, and "cyan" is a really common color name from the CMYK colorspace, which is exactly #00FFFF rgb(0,255,255), so better to go with "aqua" So: |
We should probably put this conversation on hold for a bit, pending more feedback from the UW group and Tableau. This issue triggered a couple of other email chains which hopefully will get resolved soon. |
Literally a minute after I left my last comment I got an email from @jheer (Jeff Heer)
so we should take that as the canonical names and go with that. Maybe use |
Looking at the colour code With the namespace, I suggest we put in the list of 20 colours as blue, lightblue, orange, lightorange, etctera, perhaps with a space or underscore, and then simply skip the light colours for assigning to the default prop_cycle, with |
We brainstormed today to find the color names of all possible colors in the vega cycles. We aimed at having only one namespace, and here is what we came up with. |
@tacaswell Any word back from Tableau? Did you just try their main contact, or did you also try some of the specific people in the company, like the person who wrote the blog post cited above for how they devised their new colour scheme. |
I am talking to specific people, I'll update as soon as I know anything new. I am being a bit circumspect as I do not know if everyone on those email threads is ok with them being public. Please do not start a second strand of inquiry with them. |
Of course not, I wouldn't dream of imposing myself like that. It has been two weeks though so I wondered if anything had come of it. I really love the colour scheme, especially for matplotlib and to come clean I have some public projects which I want to use it on ASAP, so I would like the all clear. P.S. I should really try and come onto the Skype meetings. I shall try and free myself up to do so. |
I like most of those colour names and agree with most of them. Category 10 and 20 look good, as does 20c, generally. For 20b, it would be nice if all the colours did not correspond with the main 10 colours. That would emphasize that they are in a different set without having to modify the prefix explicitly. The red and pink in 20b don't really match with 10's red and pink, so I think that's also a good reason not to call them that as well. Using magenta for 20b's pink seems reasonable, and for 20b's red, maybe coral or salmon (but definitely not pink). Also, there should probably be a grey alias for the gray. |
It would be nice if
referred to the new MPL 2.0 default green and red, so we could access them as easily as we could before, instead of using meaningless names like "C0" and "C1". |
Hi @endolith |
I'm closing this issue, but we should probably document the color naming better. |
The nice thing about the 'CN' names is that they will always track your current color cycle. |
The new default color cycle (Vega10, http://matplotlib.org/devdocs/users/dflt_style_changes.html#colors-color-cycles-and-color-maps) is pretty nice, but the colors are not named. Thus, the only way to refer to a specific color in that cycle is with the "Cn" syntax, which does not read as well.
For examples, consider something like
The intent is certainly less legible than
(using green for positive values and red for negative values is a not so rare convention).
(Of course, just using "g" and "r" or whatever CSS/XKCD color names doesn't really work either if you want to blend well with other figure elements that use the Vega10 palette.)
Thus, I'd suggest adding names to the colors of the Vega10/Vega20 palette, e.g. using the "vega:" prefix. Something like "blue", "orange", "green", "red", "purple", "brown", "pink", "gray", "yellow", "cyan" (all prefixed by "vega:" -- I don't think we can use "v:" due to the possible confusion with the
triangle_down
marker -- depends on the exact way the parser works...) looks close to what the colors are. The Vega20 palette (which adds lighter versions of all colors) can be supported as "vega:lightblue", etc. See https://github.com/vega/vega/wiki/Scales#scale-range-literals for the full palette.Thoughts? The implementation itself is easy of course (just add the names to the named colors dict).
I think this should be milestoned to 2.0 or 2.0.1.
The text was updated successfully, but these errors were encountered: