-
Notifications
You must be signed in to change notification settings - Fork 120
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
Color blind friendly color palettes #624
Comments
Not a fan of white middle colour that's for sure... Is there a list of options that can be pasted in the chat below? |
Thanks, Martijn @mtennekes for this follow-up. I will look at this in more detail as soon as I can. Just a couple of quick comments now already:
What I still have to check in detail are the scores that you used to rank the palettes and how I would use these. But this will probably need a bit more time |
Sure:
See also this post #566 (comment) |
Yes, I meant diverging and not bivariate. Typo:-) I am struggling the most with the middle color in combination with the color for missing values (and optionally a greyscale background map). Personally, I also don't like white as middle color, but dislike black even worse. There are a few palettes that use another hue for middle color, not only There are only a few palettes that use light grey (but not too light): e.g. From a practical point of view, using a grey middle color using a greyscale background map (e.g. StamenTonerLite or CartoDBPositron or Esri.WorldGreyCanvas (https://leaflet-extras.github.io/leaflet-providers/preview/)) does not work well. For those applications a hued middle color is better. I am not looking for a perfect diverging palette: we could recommend Still a color for missing values is needed. We could quantitatively determine the best color by computing the color in the (HCL) color space with the largest distance to any color in the (given) palette. This should be computed for each of the different CVD types. I am very curious what comes out. I agree that maximizing the distance in each arm is less important than discriminating the two arms from each other. Please feel free to experiment with the quality indicators. Mine are just initial ideas, but far from perfect. As target we could aim for quality functions to include in the |
Tagging @mputs who knows a lot more about visual perception than I do. Marco: this is the link with 30 diverging color palettes with color vision deficiency simulations: https://github.com/r-tmap/tmap/files/7978336/biv_plots.zip |
Martijn @mtennekes could you expand on why it is important that the neutral color needs to be very different from the background color? Do you have a pair of examples that illustrates why this can be important? I'm asking because usually I would argue that the neutral color should almost blend into the background. For me, diverging palettes are about bringing out whether something is "interesting" in two directions "interesting & positive" vs. "interesting & negative". So the neutral observations in the center are "uninteresting" and hence it's ok if these disappear into the background. But maybe I'm thinking too much of heatmaps than of actual maps. So an example would help me here. As for the color for missing values: I guess this depends on how much you want these to stand out. Using white is often a good compromise between being clearly visible while not being too distracting at the same time. But on a black/dark background it may still be too heavy. |
Thanks for bringing this up, Achim @zeileis. I agree that the extremes of a diverging palette are more interesting, but it is also important to know where features are that have a neutral color. Example from an older project at Statistics Netherlands in which we estimated the present population per municipality: When light grey was used instead of yellow, the shape of the Netherlands would have been less clear. Neutral color are even more important when plotting transport/road network data, e.g. traffic intensities. As a user I would like to know which roads are included in the analysis, which would be less clear if the neutral color blends in with the background map. Perhaps Robin @Robinlovelace has some examples? |
I do have examples, will dig them out... |
Thanks for sharing these examples, this indeed helps to understand your points. In Robin's two maps I agree that it is important to have colors with enough chroma to make the shading visible on the map at all. In this particular application, though, it's not so clear that this needs to be a diverging rather than a sequential palette. But I can easily imagine a similar map with a quantity that really needs a diverging palette - and then you need something with enough chroma throughout. In the map of the Netherlands that Martijn shared, my impression is that there is too much chroma. I have the feeling that I have to concentrate much more on where and how the patterns change. |
Thanks Robin and Achim for your input, very helpful! Based on these insights and examples we could already make some guidelines:
This discussion also holds for sequential palettes: for palettes with one hue, one question is whether the brightest color stands out enough. Since there is no middle color in these palettes, it is often worthwhile to use a spectral palette. Let me know if you have anything to add. |
Maps for the top 30 palettes (from 30th to the 1st place) mentioned in the first post. blueyellow2Earthberlinredgreenpiygbrbgkovesi diverging_linear_bjy_30_90_c45ocena deltaromacorkbrewer rdylburdylbukovesi diverging_bkr_55_10_c35rdbuocean balancetofinocoolwarmbluered3kovesi diverging_bwr_55_98_c37cividispuorkovesi diverging_bwr_40_95_c42purlplebrownbrocprgnpurplegreenkovesi diverging_gwv_55_95_c39lisbonkovesi diverging_bky_60_10_c30vik |
Just a few comments:
|
Very nice to see so much progress, thanks everybody for the follow-ups and improvements. Just some short additions to Martijn's guidelines:
|
Color blind friendly scores for all palettes that are currently available in tmap4. Next step is to reduce the palettes to color blind friendly palettes only, and organize them better. The scores I applied (third column) are:
The scores are applied to all types of cvd: the worst score is taken. Below, palettes are sorted from best to worst according these scores. For categorical palettes, I made 5 selections: those with at least 6, 8, 10, 12, and 20 colors respectively. Some findings:
top: the palette for people with normal color vision, bottom: for deutans (protans is similar) Normal color visionDeutanProtanTritan |
Just to say: the palette options above look great, big improvement on the list you could see with |
Follow-up which closes this topic: https://github.com/mtennekes/cols4all |
Thanks Robin! remotes::install_github("mtennekes/cols4all")
library(cols4all)
pals = list(cycling = sequential_hcl(n = 11, h = c(141, 6), c = c(70, NA, 86), l = c(73, 52), power = c(0.7, 1.9)))
c4a_series_add_as_is(pals, xNA = NA, types = "seq", series = "robin")
c4a_gui() gives So your palette is certainly a good starting point. It is well-balanced, and doesn't have intense (high chroma) colors. For 'protan' the colors are still a bit too similar. I have set the threshold value for "minimal step" to 5 (5+ means "color-blind-friendly"), and your palettes scores 2. |
A follow-up on #566 and #593 In search for qualitative good color palettes, color blind friendliness is crucial.
To get started, I calculated three quality scores for diverging color palettes that are currently included in tmap4 (from grDevices, pals, and rcartocolor), and plotted World maps.
The quality scores I computed are:
inter_wing_dist
minimal distance between from one wing (any color) to the other wing (any color). The idea is that the wings (or arms as mentioned by @zeilies Color palettes: native support for thepals
package? #566 (comment)) should be as distinguishable as possible.Let a step be the distance from one color to a neighboring color, then:
min_step
is the minimal stepstep_indicator
represents the homogeneity of the steps, more precisely, it represents how much the smallest or largest step deviates from the mean step:max(abs(step - mean(step))) / mean(step)
.These three quality indices are computed for all three color vision deficiency types: per quality indicator, the worst score is returned. I don't care about normal color vision, because the quality scores should be better by definition. Note: I took the distance values for
colorblindcheck::palette_dist()
for granted. I haven't studied individual H, C, L levels yet.See the reproducible script: sandbox/color_blind_check.R
I also computed a total score between 0 (bad) and 1 (good). See script how I did this.
According to this score, hcl palette
vik
(grDevices::hcl.colors(7, palette = "vik")
) is the best one.output of this script, maps for the top 30 palettes
However, there are two additional nice-to-haves:
Which ones do you like?
My approach is to use this kind of analysis 1) to filter out color-blind-unfriendly palettes from the tmap color palette catalogue, and 2) to use one as a new default.
If you have any further ideas @Nowosad and @zeileis let me know.
The text was updated successfully, but these errors were encountered: