-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Implements the Okabe-Ito accessible colormap. #30821
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
base: main
Are you sure you want to change the base?
Implements the Okabe-Ito accessible colormap. #30821
Conversation
|
Thanks for the interest in contributing! We have a high bar on adding new colormaps: https://matplotlib.org/devdocs/devel/api_changes.html#add-or-change-colormaps-color-sequences-and-styles In matplotlib 3.10 we added a new colorblind friendly colormap: https://matplotlib.org/devdocs/release/prev_whats_new/whats_new_3.10.0.html#accessible-colors |
|
Thank for your reply Tim. I think it’s a valuable addition that might help a lot of people. It’s quite a state-of-the-art palette for qualitative data representation. Claus Wilke uses it as the default scale in one of the leading references on data visualization: ‘Fundamentals of Data Visualization’. But why? It is designed to address color blindness (and does so very well) while also being reliably print-friendly (something alternative colormaps are less). On color fidelity:
On contrast:
About other palettes:
Note: the original Okabe-Ito yellow is quite light and can be problematic in some print workflows. It is sometimes advised to replace it with a slightly darker amber variant (for example, #f5c710, as in ggplot2). P.-S. If you’re curious about comparative evaluations: have a look at Table 2. |
|
What's the licensing on Okabe-Ito? |
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.
If we take this PR then we have to decide on a name - we don't want to crown one sequence as "accessible". Also looks like there are stray commits that I think a rebase would fix.
ETA: I'm a +1 on accepting this, so long as the license is fine - it's a published sequence that's been implemented in other visualization tools & addresses accessibility constraints the other sequences don't.
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.
Changed sequence name from 'Accessible' to 'Okabe_Ito', feel free to suggest any other better name.
Fixed comment Co-authored-by: hannah <story645@gmail.com>
story645 suggestion. Co-authored-by: hannah <story645@gmail.com>
Co-authored-by: hannah <story645@gmail.com>
1aa6f0b to
ce41bed
Compare
|
I‘m +1 on adding this. We should decide on a naming convention for color sequences. Right now we have some color sequences starting with a capital letter, some with lowercase https://matplotlib.org/devdocs/gallery/color/color_sequences.html. We don’t yet have ones consisting of multiple words. Options:
IMHO: 3 is not readable and errorprone due to similarity of capital I and lowercase l. 2. is a bit uncommon in that underscore+capitalization is rarely used together. 6. is too mashed together. My favorites are 1 and 5. 5 being the standard convention for python names. 1. is a common notation in texts to name things created by multiple authors „the Okabe-Ito color sequence“. Both are partially consistent with our current naming. What do you think? |
|
IMHO 5: Using hyphens inside string dictionary keys is fine ({"okabe-ito": palette}) but it will throw syntax errors if used for variable names (the hyphen is the subtraction operator: okabe-ito reads as okabe - ito). |
|
I'm also a vote for 5 since I think it's the most intuitive when folks are writing code. |
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.
How do we stand to this comment?
Note: the original Okabe-Ito yellow is quite light and can be problematic in some print workflows. It is sometimes advised to replace it with a slightly darker amber variant (for example, #f5c710, as in ggplot2).
Do you have reference for that advice? In particular a discussion in ggplot2 or even a comment of the original authors on this would be helpful.
Yes:
From the R documentation. The trade-off with amber-variant is that it becomes less distinguishable from the orange (#e69f00) but it's still OK in terms of ΔE (metric used to assess how distinguishable two colors are). A preview that helps observe that more clearly: If you prefer the amber variant, I will replace the original yellow: with the amber alternative: |
|
IMHO neither is really good and it depends on the display. 😢 With three tested displays, sometimes Yellow looks too faint, sometimes Amber is too close to Orange. |

PR summary
This pull request proposes an implementation of the Okabe-Ito qualitative colormap introduced by this research paper:
The paper recommends "a set of colors that is unambiguous both to colorblinds and non-colorblinds".
This colormap is supported by later research and is already implemented in software like ggplot2. It is also important in the book "Fundamentals of Data Visualization" by Claus Wilke.
Why is this change necessary?
Everyone does not see the same way. More than 20% of the time, a plot will be reviewed by at least one individual with a color vision deficiency.
What problem does it solve?
It bridges the gap between users with different visual abilities by providing a colormap that is visually appealing and accessible to all groups.
What is the reasoning for this implementation?
Allow for greater inclusivity using a scientifically backed color palette.
Source
PR checklist