GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Implements the Okabe-Ito accessible colormap. by hyperphantasia · Pull Request #30821 · matplotlib/matplotlib

Conversation

@hyperphantasia

@hyperphantasia hyperphantasia commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

PR summary

This pull request proposes an implementation of the Okabe-Ito qualitative colormap introduced by this research paper:

Okabe, M. & Ito, K. (2002). Color Universal Design (CUD)
How to make figures and presentations that are friendly to Colorblind people. https://jfly.uni-koeln.de/color/

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.

accessible
Source

PR checklist

  • [N/A] "closes #0000" is in the body of the PR description to link the related issue
  • new and changed code is tested
  • Plotting related features are demonstrated in an example
  • [N/A] New Features and API Changes are noted with a directive and release note
  • Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hyperphantasia reacted with rocket emoji
All reactions
  • 🚀 1 reaction
hyperphantasia added 2 commits December 7, 2025 15:53
@hyperphantasia
Add Okabe_Ito colormap.
873da0f
@hyperphantasia
Update documentation and tests.
ca50fc4
@github-actions github-actions Bot added topic: color/color & colormaps Documentation: examples files in galleries/examples Documentation: user guide files in galleries/users_explain or doc/users labels Dec 7, 2025
@timhoffm

timhoffm commented Dec 7, 2025

Copy link
Copy Markdown
Member

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
Why is it worth also adding Okabe-Ito?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia

hyperphantasia commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

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:

  • When producing figures for publication, CMYK conversion often causes hue shifts and clipping for bright or extreme color mixtures. Okabe-Ito’s hues are less prone to such conversion artifacts, so relative contrast among series is more likely to be preserved.

  • Some palettes, like Petroff8 for example, use very bright (blue/orange) or unusual primaries (with very high green/blue mixes) that do not map well to CMYK and therefore lose distinguishability in print (Petroff has not been designed with color print-friendliness in mind See Additional accessibility constraints).

On contrast:

  • The Okabe-Ito palette mixes darker and mid-bright colors. This provides reliable contrast on both light and dark backgrounds. In contrast (ha-ha), alternatives like Tableau colorblind schemes might appear ‘muddy’ on print because of insufficient contrast.

About other palettes:

  • ColorBrewer’s Dark2 and Set1 are useful in many contexts but are less robust to CVD (let's use "color vision deficience" or CVD instead of color blindness since most actually do see colors, but differently :). It is recommended to combine them with textures or varied line styles when accessibility is required.

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.

timhoffm reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added topic: animation topic: axes labels Dec 9, 2025
@story645

story645 commented Dec 9, 2025

Copy link
Copy Markdown
Member

What's the licensing on Okabe-Ito?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@story645 story645 added the accessibility label Dec 9, 2025
story645
story645 requested changes Dec 10, 2025
View reviewed changes

@story645 story645 left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

timhoffm reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread galleries/examples/color/color_sequences.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread galleries/examples/color/colormap_reference.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread galleries/users_explain/colors/colormaps.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/matplotlib/axes/_base.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/matplotlib/mpl-data/matplotlibrc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/matplotlib/tests/test_colors.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/matplotlib/tests/test_axes.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/matplotlib/_cm.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

hyperphantasia
hyperphantasia commented Dec 10, 2025
View reviewed changes

@hyperphantasia hyperphantasia left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
hyperphantasia and others added 4 commits December 10, 2025 14:26
@hyperphantasia @story645
Update lib/matplotlib/_cm.py
0b760a2
Fixed comment

Co-authored-by: hannah <[email protected]>
@hyperphantasia @story645
Update galleries/examples/color/colormap_reference.py
04ad6c4
story645 suggestion.

Co-authored-by: hannah <[email protected]>
@hyperphantasia @story645
Update galleries/users_explain/colors/colormaps.py
afbbe4b
Co-authored-by: hannah <[email protected]>
@hyperphantasia
Renamed color sequence to authors name (Okabe Ito)
ce41bed
@hyperphantasia
hyperphantasia force-pushed the add_okabe_ito_accessible_colormap branch from 1aa6f0b to ce41bed Compare December 10, 2025 14:32
@github-actions github-actions Bot removed topic: animation topic: axes labels Dec 10, 2025
hyperphantasia added 2 commits December 10, 2025 15:04
@hyperphantasia
Fixed sequence naming issues.
5543b23
@hyperphantasia
Fixed failing tests
dce0c86
@hyperphantasia
hyperphantasia requested a review from story645 December 10, 2025 16:02
@timhoffm

timhoffm commented Dec 13, 2025

Copy link
Copy Markdown
Member

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:

  1. Okabe-Ito
  2. Okabe_Ito
  3. OkabeIto
  4. okabe-ito
  5. okabe_ito
  6. okabeito

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?

hyperphantasia reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia

hyperphantasia commented Dec 13, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

IMHO 5: okabe_ito is better and more consistent.

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).

story645 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@story645

story645 commented Dec 13, 2025

Copy link
Copy Markdown
Member

I'm also a vote for 5 since I think it's the most intuitive when folks are writing code.

hyperphantasia reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia
Changed sequence name to okabe_ito
beabac9
@hyperphantasia

hyperphantasia commented Dec 13, 2025

Copy link
Copy Markdown
Contributor Author

@timhoffm @story645 Okay, I've pushed the changes to okabe_ito (option 5).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

timhoffm
timhoffm reviewed Dec 14, 2025
View reviewed changes

@timhoffm timhoffm left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/matplotlib/_cm.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia

hyperphantasia commented Dec 14, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

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:

The original Okabe-Ito palette's "yellow" color is "#F0E442". This color is very bright and often does not show up well on white backgrounds (see here) for a discussion of this issue). Accordingly, by default, this function uses a darker more "amber" color for "yellow" ("#F5C710").

From the R documentation.

The trade-off with amber-variant is that it becomes less distinguishable from the orange (#e69f00) that is also present in the sequence 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:
comparison_colors_okabe ito

If you prefer the amber variant, I will replace the original yellow:

(0.9411764705882353, 0.8941176470588236, 0.25882352941176473),  # f0e442

with the amber alternative:

(0.9607843137254902, 0.7803921568627451, 0.06274509803921569),  # f5c710
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia
Replaced RGB values with output from matplotlib.colors.to_rgb()
fd69284
@hyperphantasia
hyperphantasia requested a review from timhoffm December 14, 2025 20:52
@timhoffm

timhoffm commented Dec 15, 2025

Copy link
Copy Markdown
Member

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia

hyperphantasia commented Dec 15, 2025

Copy link
Copy Markdown
Contributor Author

In this case I haven't found a best-of-all worlds proven solution. We could have a darker orange (a bit brownish then), but then we take the risk of messing with the red/green and lose points on CVD-friendliness.

  1. Original sequence: better overall distinguishability, but yellow performs poorly against whites.
  2. Amber-variant: amber reads better against whites, orange vs. amber can be a bit confusing (but still distinguishable).
    Both sequences are accessible in terms of CVD-friendliness.

A global preview:
okabe_variants

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia

hyperphantasia commented Dec 15, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

I’d give the amber variant a +1, imho, it looks more versatile: better against white and thus more screen/print-friendly, while still remaining CVD accessible.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@story645 story645 mentioned this pull request Dec 16, 2025
okabe-ito story645/accessviz#4
Closed
@story645

story645 commented Dec 16, 2025

Copy link
Copy Markdown
Member

Do we wanna split the difference and have 'okabe_ito' and 'okabe_ito_amber'?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia

hyperphantasia commented Dec 17, 2025

Copy link
Copy Markdown
Contributor Author

@story645 Maybe that makes the palette a bit redundant somehow but that's the option the devs agreed upon in R/ggplot2.

Accordingly, by default, this function uses a darker more "amber" color for "yellow" ("#F5C710"). This color is the "yellow" color used in base R >4.0's default color palette. The palettes "full" and "black_first" use this darker yellow color. For the original yellow color suggested by Okabe and Ito ("#F0E442"), use palettes "full_original" or "black_first_original".

story645 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@timhoffm

timhoffm commented Dec 17, 2025

Copy link
Copy Markdown
Member

It depends, on a number of aspects, including "how far apart" are the orange and yellow elements, is it lines, text, areas, etc.

image image

In these pictures, I'm +0.5 on the original as it is easier to discern from orange. Text readability is worse, but that's not the primary use of color sequences. We also have to realize it's the fifth color in the cycle and many plots use less thatn that, so maybe the topic is not too relevant.

I'd go with the original one named 'okabe_ito'. This would still leave us the option to add 'okabe_ito_amber' later.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia

hyperphantasia commented Dec 17, 2025

Copy link
Copy Markdown
Contributor Author

@timhoffm Okay, in this case, the original sequence is already implemented in the latest commits.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

timhoffm
timhoffm approved these changes Dec 18, 2025
View reviewed changes
@timhoffm

timhoffm commented Dec 18, 2025

Copy link
Copy Markdown
Member

@Brooks-Code Please add a whats new entry. See https://github.com/matplotlib/matplotlib/blob/main/doc/release/next_whats_new/README.rst

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hyperphantasia
added whats new entry
4fd39a4
@hyperphantasia

hyperphantasia commented Dec 18, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@timhoffm @story645 done, feel free to suggest any improvement :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

timhoffm
timhoffm reviewed Dec 19, 2025
View reviewed changes
Comment thread doc/release/next_whats_new/okabe_ito_colormap.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread doc/release/next_whats_new/okabe_ito_colormap.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

hyperphantasia and others added 2 commits December 19, 2025 01:21
@hyperphantasia @timhoffm
Update doc/release/next_whats_new/okabe_ito_colormap.rst
5a9e61e
Changed title per @timhoffm recommendation.

Co-authored-by: Tim Hoffmann <[email protected]>
@hyperphantasia
Update whats new per @timhoffm suggestion
0c39666
story645
story645 approved these changes Dec 19, 2025
View reviewed changes
@story645 story645 added this to the v3.11.0 milestone Dec 19, 2025
@story645
story645 merged commit bbf01d4 into matplotlib:main Dec 19, 2025
37 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@story645

story645 commented Dec 19, 2025

Copy link
Copy Markdown
Member

Thanks for improving accessibility in mpl!

hyperphantasia reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@user27182 user27182 mentioned this pull request Dec 21, 2025
Include type hints for okabe_ito colormap pyvista/pyvista#8187
Merged
andreas16700 added a commit to andreas16700/matplotlib that referenced this pull request Jan 30, 2026
@andreas16700 @claude
Run 73: Match upstream bbf01d4 (PR matplotlib#30821) - Okabe-Ito colo…
7de0a82
…rmap

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@timhoffm timhoffm timhoffm approved these changes
@story645 story645 story645 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

accessibility Documentation: examples files in galleries/examples Documentation: user guide files in galleries/users_explain or doc/users topic: color/color & colormaps

Projects

None yet

Milestone

v3.11.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@hyperphantasia @timhoffm @story645
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.