From 873da0fab2007a9716f3bb6f584a66832e3692ef Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Sun, 7 Dec 2025 15:53:59 +0000 Subject: [PATCH 01/13] Add Okabe_Ito colormap. --- lib/matplotlib/_cm.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/matplotlib/_cm.py b/lib/matplotlib/_cm.py index d3f4632108a8..12a801e4f43e 100644 --- a/lib/matplotlib/_cm.py +++ b/lib/matplotlib/_cm.py @@ -867,6 +867,22 @@ def _g36(x): return 2 * x - 1 (0.4, 0.4, 0.4 ), ) +# Okabe-Ito accessible color palette (2002). +# By Masataka Okabe (Jikei Medical School) and Kei Ito (University of Tokyo). +# Qualitative color palette that is unambiguous both to colorblinds and non-colorblinds. +# https://jfly.uni-koeln.de/color/#pallet + +_Accessible_data = ( + (0.0, 0.0, 0.0), # black + (0.901960784, 0.623529412, 0.0), # e69f00 + (0.337254902, 0.705882353, 0.91372549), # 56b4e9 + (0.0, 0.619607843, 0.450980392), # 009e73 + (0.9412, 0.894117647, 0.258823529), # f0e442 + (0.0, 0.447058824, 0.698039216), # 0072b2 + (0.835294118, 0.368627451, 0.0), # d55e00 + (0.8, 0.474509804, 0.654901961), # cc79a7 +) + _Dark2_data = ( (0.10588235294117647, 0.61960784313725492, 0.46666666666666667), (0.85098039215686272, 0.37254901960784315, 0.00784313725490196), @@ -1469,6 +1485,7 @@ def _gist_yarg(x): return 1 - x 'winter': _winter_data, # Qualitative 'Accent': {'listed': _Accent_data}, + 'Accessible': {'listed': _Accessible_data}, 'Dark2': {'listed': _Dark2_data}, 'Paired': {'listed': _Paired_data}, 'Pastel1': {'listed': _Pastel1_data}, From ca50fc43e98619efe543876066fe7c411ba32205 Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Sun, 7 Dec 2025 16:27:33 +0000 Subject: [PATCH 02/13] Update documentation and tests. --- galleries/examples/color/color_sequences.py | 4 ++-- galleries/examples/color/colormap_reference.py | 2 +- galleries/users_explain/colors/colormaps.py | 6 +++--- lib/matplotlib/cm.pyi | 2 ++ lib/matplotlib/colors.py | 1 + lib/matplotlib/tests/test_colors.py | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/galleries/examples/color/color_sequences.py b/galleries/examples/color/color_sequences.py index 4fc5571a0b69..b8100fc378b2 100644 --- a/galleries/examples/color/color_sequences.py +++ b/galleries/examples/color/color_sequences.py @@ -38,8 +38,8 @@ def plot_color_sequences(names, ax): built_in_color_sequences = [ 'tab10', 'tab20', 'tab20b', 'tab20c', 'Pastel1', 'Pastel2', 'Paired', - 'Accent', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', 'petroff8', - 'petroff10'] + 'Accent', 'Accessible', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', + 'petroff8', 'petroff10'] fig, ax = plt.subplots(figsize=(6.4, 9.6), layout='constrained') diff --git a/galleries/examples/color/colormap_reference.py b/galleries/examples/color/colormap_reference.py index 2dc091d71a45..6d9541bd8e71 100644 --- a/galleries/examples/color/colormap_reference.py +++ b/galleries/examples/color/colormap_reference.py @@ -32,7 +32,7 @@ 'berlin', 'managua', 'vanimo']), ('Cyclic', ['twilight', 'twilight_shifted', 'hsv']), ('Qualitative', [ - 'Pastel1', 'Pastel2', 'Paired', 'Accent', + 'Pastel1', 'Pastel2', 'Paired', 'Accent', 'Accessible', 'Dark2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c']), ('Miscellaneous', [ diff --git a/galleries/users_explain/colors/colormaps.py b/galleries/users_explain/colors/colormaps.py index 55989c258802..bbed2b3599fd 100644 --- a/galleries/users_explain/colors/colormaps.py +++ b/galleries/users_explain/colors/colormaps.py @@ -230,9 +230,9 @@ def plot_color_gradients(category, cmap_list): # These would not be good options for use as perceptual colormaps. plot_color_gradients('Qualitative', - ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'Dark2', - 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', - 'tab20c']) + ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'Accessible', + 'Dark2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', + 'tab20b', 'tab20c']) # %% # Miscellaneous diff --git a/lib/matplotlib/cm.pyi b/lib/matplotlib/cm.pyi index 128d1a563286..d1263caf7072 100644 --- a/lib/matplotlib/cm.pyi +++ b/lib/matplotlib/cm.pyi @@ -96,6 +96,7 @@ summer: colors.Colormap terrain: colors.Colormap winter: colors.Colormap Accent: colors.Colormap +Accessible: colors.Colormap Dark2: colors.Colormap Paired: colors.Colormap Pastel1: colors.Colormap @@ -187,6 +188,7 @@ summer_r: colors.Colormap terrain_r: colors.Colormap winter_r: colors.Colormap Accent_r: colors.Colormap +Accessible_r: colors.Colormap Dark2_r: colors.Colormap Paired_r: colors.Colormap Pastel1_r: colors.Colormap diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 07cbe4a79cb0..02f61bfa8105 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -128,6 +128,7 @@ class ColorSequenceRegistry(Mapping): 'Pastel2': _cm._Pastel2_data, 'Paired': _cm._Paired_data, 'Accent': _cm._Accent_data, + 'Accessible': _cm._Accessible_data, 'Dark2': _cm._Dark2_data, 'Set1': _cm._Set1_data, 'Set2': _cm._Set2_data, diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index 4af0c84261b8..e8d32fe59342 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -1702,8 +1702,8 @@ def test_color_sequences(): assert plt.color_sequences is matplotlib.color_sequences # same registry assert list(plt.color_sequences) == [ 'tab10', 'tab20', 'tab20b', 'tab20c', 'Pastel1', 'Pastel2', 'Paired', - 'Accent', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', 'petroff8', - 'petroff10'] + 'Accent', 'Accessible', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', + 'petroff8', 'petroff10'] assert len(plt.color_sequences['tab10']) == 10 assert len(plt.color_sequences['tab20']) == 20 From 0b760a2f0eecdd2894e0481215c3a4d9f852d064 Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Wed, 10 Dec 2025 01:41:38 +0100 Subject: [PATCH 03/13] Update lib/matplotlib/_cm.py Fixed comment Co-authored-by: hannah --- lib/matplotlib/_cm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/_cm.py b/lib/matplotlib/_cm.py index 12a801e4f43e..0c0dd2440f28 100644 --- a/lib/matplotlib/_cm.py +++ b/lib/matplotlib/_cm.py @@ -869,7 +869,7 @@ def _g36(x): return 2 * x - 1 # Okabe-Ito accessible color palette (2002). # By Masataka Okabe (Jikei Medical School) and Kei Ito (University of Tokyo). -# Qualitative color palette that is unambiguous both to colorblinds and non-colorblinds. +# Qualitative color palette that is unambiguous regardless of whether the viewer has colorblindness. # https://jfly.uni-koeln.de/color/#pallet _Accessible_data = ( From 04ad6c412132460d0b6e61658f44c9ae344d81af Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Wed, 10 Dec 2025 02:06:47 +0100 Subject: [PATCH 04/13] Update galleries/examples/color/colormap_reference.py story645 suggestion. Co-authored-by: hannah --- galleries/examples/color/colormap_reference.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/examples/color/colormap_reference.py b/galleries/examples/color/colormap_reference.py index 6d9541bd8e71..5ef542f21d68 100644 --- a/galleries/examples/color/colormap_reference.py +++ b/galleries/examples/color/colormap_reference.py @@ -32,7 +32,7 @@ 'berlin', 'managua', 'vanimo']), ('Cyclic', ['twilight', 'twilight_shifted', 'hsv']), ('Qualitative', [ - 'Pastel1', 'Pastel2', 'Paired', 'Accent', 'Accessible', + 'Pastel1', 'Pastel2', 'Paired', 'Accent', 'Okabe-Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c']), ('Miscellaneous', [ From afbbe4b4c1b4eff4669ce6bbf83876c86b6a20e0 Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Wed, 10 Dec 2025 02:07:29 +0100 Subject: [PATCH 05/13] Update galleries/users_explain/colors/colormaps.py Co-authored-by: hannah --- galleries/users_explain/colors/colormaps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/users_explain/colors/colormaps.py b/galleries/users_explain/colors/colormaps.py index bbed2b3599fd..548817a90fcb 100644 --- a/galleries/users_explain/colors/colormaps.py +++ b/galleries/users_explain/colors/colormaps.py @@ -230,7 +230,7 @@ def plot_color_gradients(category, cmap_list): # These would not be good options for use as perceptual colormaps. plot_color_gradients('Qualitative', - ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'Accessible', + ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'Okabe-Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c']) From ce41bedf99d0cefc7c4a19c6c8bfe7144bcedf84 Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Wed, 10 Dec 2025 01:52:41 +0000 Subject: [PATCH 06/13] Renamed color sequence to authors name (Okabe Ito) --- galleries/examples/color/color_sequences.py | 2 +- lib/matplotlib/_cm.py | 33 ++++++++++----------- lib/matplotlib/cm.pyi | 4 +-- lib/matplotlib/colors.py | 2 +- lib/matplotlib/tests/test_colors.py | 2 +- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/galleries/examples/color/color_sequences.py b/galleries/examples/color/color_sequences.py index b8100fc378b2..0fde7d20c499 100644 --- a/galleries/examples/color/color_sequences.py +++ b/galleries/examples/color/color_sequences.py @@ -38,7 +38,7 @@ def plot_color_sequences(names, ax): built_in_color_sequences = [ 'tab10', 'tab20', 'tab20b', 'tab20c', 'Pastel1', 'Pastel2', 'Paired', - 'Accent', 'Accessible', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', + 'Accent', 'Okabe-Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', 'petroff8', 'petroff10'] diff --git a/lib/matplotlib/_cm.py b/lib/matplotlib/_cm.py index 0c0dd2440f28..6dc788f66eae 100644 --- a/lib/matplotlib/_cm.py +++ b/lib/matplotlib/_cm.py @@ -852,7 +852,6 @@ def _g36(x): return 2 * x - 1 (0.50196078431372548, 0.0 , 0.14901960784313725) ) - # ColorBrewer's qualitative maps, implemented using ListedColormap # for use with mpl.colors.NoNorm @@ -867,12 +866,23 @@ def _g36(x): return 2 * x - 1 (0.4, 0.4, 0.4 ), ) -# Okabe-Ito accessible color palette (2002). +_Dark2_data = ( + (0.10588235294117647, 0.61960784313725492, 0.46666666666666667), + (0.85098039215686272, 0.37254901960784315, 0.00784313725490196), + (0.45882352941176469, 0.4392156862745098, 0.70196078431372544), + (0.90588235294117647, 0.16078431372549021, 0.54117647058823526), + (0.4, 0.65098039215686276, 0.11764705882352941), + (0.90196078431372551, 0.6705882352941176, 0.00784313725490196), + (0.65098039215686276, 0.46274509803921571, 0.11372549019607843), + (0.4, 0.4, 0.4 ), + ) + +# Okabe-Ito accessible and print-friendly color palette (2002). # By Masataka Okabe (Jikei Medical School) and Kei Ito (University of Tokyo). -# Qualitative color palette that is unambiguous regardless of whether the viewer has colorblindness. -# https://jfly.uni-koeln.de/color/#pallet +# Qualitative color palette that is unambiguous regardless of whether +# the viewer has colorblindness. https://jfly.uni-koeln.de/color/#pallet -_Accessible_data = ( +_Okabe_Ito_data = ( (0.0, 0.0, 0.0), # black (0.901960784, 0.623529412, 0.0), # e69f00 (0.337254902, 0.705882353, 0.91372549), # 56b4e9 @@ -883,17 +893,6 @@ def _g36(x): return 2 * x - 1 (0.8, 0.474509804, 0.654901961), # cc79a7 ) -_Dark2_data = ( - (0.10588235294117647, 0.61960784313725492, 0.46666666666666667), - (0.85098039215686272, 0.37254901960784315, 0.00784313725490196), - (0.45882352941176469, 0.4392156862745098, 0.70196078431372544), - (0.90588235294117647, 0.16078431372549021, 0.54117647058823526), - (0.4, 0.65098039215686276, 0.11764705882352941), - (0.90196078431372551, 0.6705882352941176, 0.00784313725490196), - (0.65098039215686276, 0.46274509803921571, 0.11372549019607843), - (0.4, 0.4, 0.4 ), - ) - _Paired_data = ( (0.65098039215686276, 0.80784313725490198, 0.8901960784313725 ), (0.12156862745098039, 0.47058823529411764, 0.70588235294117652), @@ -1485,7 +1484,7 @@ def _gist_yarg(x): return 1 - x 'winter': _winter_data, # Qualitative 'Accent': {'listed': _Accent_data}, - 'Accessible': {'listed': _Accessible_data}, + 'Okabe-Ito': {'listed': _Okabe_Ito_data}, 'Dark2': {'listed': _Dark2_data}, 'Paired': {'listed': _Paired_data}, 'Pastel1': {'listed': _Pastel1_data}, diff --git a/lib/matplotlib/cm.pyi b/lib/matplotlib/cm.pyi index d1263caf7072..495ce19b7835 100644 --- a/lib/matplotlib/cm.pyi +++ b/lib/matplotlib/cm.pyi @@ -96,8 +96,8 @@ summer: colors.Colormap terrain: colors.Colormap winter: colors.Colormap Accent: colors.Colormap -Accessible: colors.Colormap Dark2: colors.Colormap +Okabe_Ito: colors.Colormap Paired: colors.Colormap Pastel1: colors.Colormap Pastel2: colors.Colormap @@ -188,8 +188,8 @@ summer_r: colors.Colormap terrain_r: colors.Colormap winter_r: colors.Colormap Accent_r: colors.Colormap -Accessible_r: colors.Colormap Dark2_r: colors.Colormap +Okabe_Ito_r: colors.Colormap Paired_r: colors.Colormap Pastel1_r: colors.Colormap Pastel2_r: colors.Colormap diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 02f61bfa8105..a46c2d922ab5 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -128,11 +128,11 @@ class ColorSequenceRegistry(Mapping): 'Pastel2': _cm._Pastel2_data, 'Paired': _cm._Paired_data, 'Accent': _cm._Accent_data, - 'Accessible': _cm._Accessible_data, 'Dark2': _cm._Dark2_data, 'Set1': _cm._Set1_data, 'Set2': _cm._Set2_data, 'Set3': _cm._Set3_data, + 'Okabe-Ito': _cm._Okabe_Ito_data, 'petroff6': _cm._petroff6_data, 'petroff8': _cm._petroff8_data, 'petroff10': _cm._petroff10_data, diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index e8d32fe59342..7e41fe9c5899 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -1702,7 +1702,7 @@ def test_color_sequences(): assert plt.color_sequences is matplotlib.color_sequences # same registry assert list(plt.color_sequences) == [ 'tab10', 'tab20', 'tab20b', 'tab20c', 'Pastel1', 'Pastel2', 'Paired', - 'Accent', 'Accessible', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', + 'Accent', 'Okabe-Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', 'petroff8', 'petroff10'] assert len(plt.color_sequences['tab10']) == 10 assert len(plt.color_sequences['tab20']) == 20 From 5543b23c327c7b480a2f7205ea9d66c653fd3b73 Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Wed, 10 Dec 2025 15:04:15 +0000 Subject: [PATCH 07/13] Fixed sequence naming issues. --- galleries/examples/color/color_sequences.py | 2 +- galleries/examples/color/colormap_reference.py | 2 +- galleries/users_explain/colors/colormaps.py | 2 +- lib/matplotlib/_cm.py | 4 ++-- lib/matplotlib/colors.py | 2 +- lib/matplotlib/tests/test_colors.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/galleries/examples/color/color_sequences.py b/galleries/examples/color/color_sequences.py index 0fde7d20c499..355e14a62833 100644 --- a/galleries/examples/color/color_sequences.py +++ b/galleries/examples/color/color_sequences.py @@ -38,7 +38,7 @@ def plot_color_sequences(names, ax): built_in_color_sequences = [ 'tab10', 'tab20', 'tab20b', 'tab20c', 'Pastel1', 'Pastel2', 'Paired', - 'Accent', 'Okabe-Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', + 'Accent', 'Okabe_Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', 'petroff8', 'petroff10'] diff --git a/galleries/examples/color/colormap_reference.py b/galleries/examples/color/colormap_reference.py index 5ef542f21d68..f68997666a9b 100644 --- a/galleries/examples/color/colormap_reference.py +++ b/galleries/examples/color/colormap_reference.py @@ -32,7 +32,7 @@ 'berlin', 'managua', 'vanimo']), ('Cyclic', ['twilight', 'twilight_shifted', 'hsv']), ('Qualitative', [ - 'Pastel1', 'Pastel2', 'Paired', 'Accent', 'Okabe-Ito', + 'Pastel1', 'Pastel2', 'Paired', 'Accent', 'Okabe_Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c']), ('Miscellaneous', [ diff --git a/galleries/users_explain/colors/colormaps.py b/galleries/users_explain/colors/colormaps.py index 548817a90fcb..2fd2bfa91514 100644 --- a/galleries/users_explain/colors/colormaps.py +++ b/galleries/users_explain/colors/colormaps.py @@ -230,7 +230,7 @@ def plot_color_gradients(category, cmap_list): # These would not be good options for use as perceptual colormaps. plot_color_gradients('Qualitative', - ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'Okabe-Ito', + ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'Okabe_Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c']) diff --git a/lib/matplotlib/_cm.py b/lib/matplotlib/_cm.py index 6dc788f66eae..6c381f0e9d64 100644 --- a/lib/matplotlib/_cm.py +++ b/lib/matplotlib/_cm.py @@ -877,7 +877,7 @@ def _g36(x): return 2 * x - 1 (0.4, 0.4, 0.4 ), ) -# Okabe-Ito accessible and print-friendly color palette (2002). +# Okabe-Ito accessible and print-friendly color palette . # By Masataka Okabe (Jikei Medical School) and Kei Ito (University of Tokyo). # Qualitative color palette that is unambiguous regardless of whether # the viewer has colorblindness. https://jfly.uni-koeln.de/color/#pallet @@ -1484,7 +1484,7 @@ def _gist_yarg(x): return 1 - x 'winter': _winter_data, # Qualitative 'Accent': {'listed': _Accent_data}, - 'Okabe-Ito': {'listed': _Okabe_Ito_data}, + 'Okabe_Ito': {'listed': _Okabe_Ito_data}, 'Dark2': {'listed': _Dark2_data}, 'Paired': {'listed': _Paired_data}, 'Pastel1': {'listed': _Pastel1_data}, diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index a46c2d922ab5..e8ac8db94dc1 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -132,7 +132,7 @@ class ColorSequenceRegistry(Mapping): 'Set1': _cm._Set1_data, 'Set2': _cm._Set2_data, 'Set3': _cm._Set3_data, - 'Okabe-Ito': _cm._Okabe_Ito_data, + 'Okabe_Ito': _cm._Okabe_Ito_data, 'petroff6': _cm._petroff6_data, 'petroff8': _cm._petroff8_data, 'petroff10': _cm._petroff10_data, diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index 7e41fe9c5899..2110cfec02f6 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -1702,7 +1702,7 @@ def test_color_sequences(): assert plt.color_sequences is matplotlib.color_sequences # same registry assert list(plt.color_sequences) == [ 'tab10', 'tab20', 'tab20b', 'tab20c', 'Pastel1', 'Pastel2', 'Paired', - 'Accent', 'Okabe-Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', + 'Accent', 'Okabe_Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', 'petroff8', 'petroff10'] assert len(plt.color_sequences['tab10']) == 10 assert len(plt.color_sequences['tab20']) == 20 From dce0c8638c8273b7c20c377dfbe762bdf8cd90d4 Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Wed, 10 Dec 2025 15:42:11 +0000 Subject: [PATCH 08/13] Fixed failing tests --- lib/matplotlib/colors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index e8ac8db94dc1..28f6281ff429 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -128,11 +128,11 @@ class ColorSequenceRegistry(Mapping): 'Pastel2': _cm._Pastel2_data, 'Paired': _cm._Paired_data, 'Accent': _cm._Accent_data, + 'Okabe_Ito': _cm._Okabe_Ito_data, 'Dark2': _cm._Dark2_data, 'Set1': _cm._Set1_data, 'Set2': _cm._Set2_data, 'Set3': _cm._Set3_data, - 'Okabe_Ito': _cm._Okabe_Ito_data, 'petroff6': _cm._petroff6_data, 'petroff8': _cm._petroff8_data, 'petroff10': _cm._petroff10_data, From beabac9bfc7731b868aee1f1dba9e8b7fca06a6f Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Sat, 13 Dec 2025 23:37:19 +0000 Subject: [PATCH 09/13] Changed sequence name to okabe_ito --- galleries/examples/color/color_sequences.py | 2 +- galleries/examples/color/colormap_reference.py | 2 +- galleries/users_explain/colors/colormaps.py | 2 +- lib/matplotlib/_cm.py | 4 ++-- lib/matplotlib/cm.pyi | 4 ++-- lib/matplotlib/colors.py | 2 +- lib/matplotlib/tests/test_colors.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/galleries/examples/color/color_sequences.py b/galleries/examples/color/color_sequences.py index 355e14a62833..4d7324b55a12 100644 --- a/galleries/examples/color/color_sequences.py +++ b/galleries/examples/color/color_sequences.py @@ -38,7 +38,7 @@ def plot_color_sequences(names, ax): built_in_color_sequences = [ 'tab10', 'tab20', 'tab20b', 'tab20c', 'Pastel1', 'Pastel2', 'Paired', - 'Accent', 'Okabe_Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', + 'Accent', 'okabe_ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', 'petroff8', 'petroff10'] diff --git a/galleries/examples/color/colormap_reference.py b/galleries/examples/color/colormap_reference.py index f68997666a9b..eedf6ec11737 100644 --- a/galleries/examples/color/colormap_reference.py +++ b/galleries/examples/color/colormap_reference.py @@ -32,7 +32,7 @@ 'berlin', 'managua', 'vanimo']), ('Cyclic', ['twilight', 'twilight_shifted', 'hsv']), ('Qualitative', [ - 'Pastel1', 'Pastel2', 'Paired', 'Accent', 'Okabe_Ito', + 'Pastel1', 'Pastel2', 'Paired', 'Accent', 'okabe_ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c']), ('Miscellaneous', [ diff --git a/galleries/users_explain/colors/colormaps.py b/galleries/users_explain/colors/colormaps.py index 2fd2bfa91514..263c3c72e8ea 100644 --- a/galleries/users_explain/colors/colormaps.py +++ b/galleries/users_explain/colors/colormaps.py @@ -230,7 +230,7 @@ def plot_color_gradients(category, cmap_list): # These would not be good options for use as perceptual colormaps. plot_color_gradients('Qualitative', - ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'Okabe_Ito', + ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'okabe_ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c']) diff --git a/lib/matplotlib/_cm.py b/lib/matplotlib/_cm.py index 6c381f0e9d64..8ff82bb17734 100644 --- a/lib/matplotlib/_cm.py +++ b/lib/matplotlib/_cm.py @@ -882,7 +882,7 @@ def _g36(x): return 2 * x - 1 # Qualitative color palette that is unambiguous regardless of whether # the viewer has colorblindness. https://jfly.uni-koeln.de/color/#pallet -_Okabe_Ito_data = ( +_okabe_ito_data = ( (0.0, 0.0, 0.0), # black (0.901960784, 0.623529412, 0.0), # e69f00 (0.337254902, 0.705882353, 0.91372549), # 56b4e9 @@ -1484,7 +1484,7 @@ def _gist_yarg(x): return 1 - x 'winter': _winter_data, # Qualitative 'Accent': {'listed': _Accent_data}, - 'Okabe_Ito': {'listed': _Okabe_Ito_data}, + 'okabe_ito': {'listed': _okabe_ito_data}, 'Dark2': {'listed': _Dark2_data}, 'Paired': {'listed': _Paired_data}, 'Pastel1': {'listed': _Pastel1_data}, diff --git a/lib/matplotlib/cm.pyi b/lib/matplotlib/cm.pyi index 495ce19b7835..f4b9fb9ea8dd 100644 --- a/lib/matplotlib/cm.pyi +++ b/lib/matplotlib/cm.pyi @@ -97,7 +97,7 @@ terrain: colors.Colormap winter: colors.Colormap Accent: colors.Colormap Dark2: colors.Colormap -Okabe_Ito: colors.Colormap +okabe_ito: colors.Colormap Paired: colors.Colormap Pastel1: colors.Colormap Pastel2: colors.Colormap @@ -189,7 +189,7 @@ terrain_r: colors.Colormap winter_r: colors.Colormap Accent_r: colors.Colormap Dark2_r: colors.Colormap -Okabe_Ito_r: colors.Colormap +okabe_ito_r: colors.Colormap Paired_r: colors.Colormap Pastel1_r: colors.Colormap Pastel2_r: colors.Colormap diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 28f6281ff429..28a47a1b70cf 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -128,7 +128,7 @@ class ColorSequenceRegistry(Mapping): 'Pastel2': _cm._Pastel2_data, 'Paired': _cm._Paired_data, 'Accent': _cm._Accent_data, - 'Okabe_Ito': _cm._Okabe_Ito_data, + 'okabe_ito': _cm._okabe_ito_data, 'Dark2': _cm._Dark2_data, 'Set1': _cm._Set1_data, 'Set2': _cm._Set2_data, diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index 2110cfec02f6..a15e4fee64da 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -1702,7 +1702,7 @@ def test_color_sequences(): assert plt.color_sequences is matplotlib.color_sequences # same registry assert list(plt.color_sequences) == [ 'tab10', 'tab20', 'tab20b', 'tab20c', 'Pastel1', 'Pastel2', 'Paired', - 'Accent', 'Okabe_Ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', + 'Accent', 'okabe_ito', 'Dark2', 'Set1', 'Set2', 'Set3', 'petroff6', 'petroff8', 'petroff10'] assert len(plt.color_sequences['tab10']) == 10 assert len(plt.color_sequences['tab20']) == 20 From fd692842dad9474ae3b2e98e91995deeb840d3e7 Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Sun, 14 Dec 2025 19:46:21 +0000 Subject: [PATCH 10/13] Replaced RGB values with output from matplotlib.colors.to_rgb() --- lib/matplotlib/_cm.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/matplotlib/_cm.py b/lib/matplotlib/_cm.py index 8ff82bb17734..cdad80bc9ddc 100644 --- a/lib/matplotlib/_cm.py +++ b/lib/matplotlib/_cm.py @@ -877,20 +877,20 @@ def _g36(x): return 2 * x - 1 (0.4, 0.4, 0.4 ), ) -# Okabe-Ito accessible and print-friendly color palette . +# Okabe-Ito accessible and print-friendly color palette. # By Masataka Okabe (Jikei Medical School) and Kei Ito (University of Tokyo). # Qualitative color palette that is unambiguous regardless of whether # the viewer has colorblindness. https://jfly.uni-koeln.de/color/#pallet _okabe_ito_data = ( - (0.0, 0.0, 0.0), # black - (0.901960784, 0.623529412, 0.0), # e69f00 - (0.337254902, 0.705882353, 0.91372549), # 56b4e9 - (0.0, 0.619607843, 0.450980392), # 009e73 - (0.9412, 0.894117647, 0.258823529), # f0e442 - (0.0, 0.447058824, 0.698039216), # 0072b2 - (0.835294118, 0.368627451, 0.0), # d55e00 - (0.8, 0.474509804, 0.654901961), # cc79a7 + (0.0, 0.0, 0.0), # black + (0.9019607843137255, 0.6235294117647059, 0.0), # e69f00 + (0.33725490196078434, 0.7058823529411765, 0.9137254901960784), # 56b4e9 + (0.0, 0.6196078431372549, 0.45098039215686275), # 009e73 + (0.9411764705882353, 0.8941176470588236, 0.25882352941176473), # f0e442 + (0.0, 0.4470588235294118, 0.6980392156862745), # 0072b2 + (0.8352941176470589, 0.3686274509803922, 0.0), # d55e00 + (0.8, 0.4745098039215686, 0.6549019607843137), # cc79a7 ) _Paired_data = ( From 4fd39a4b7297875c85844eebbb8cb98599ab8cc4 Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Thu, 18 Dec 2025 16:58:05 +0000 Subject: [PATCH 11/13] added whats new entry --- .../next_whats_new/okabe_ito_colormap.rst | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 doc/release/next_whats_new/okabe_ito_colormap.rst diff --git a/doc/release/next_whats_new/okabe_ito_colormap.rst b/doc/release/next_whats_new/okabe_ito_colormap.rst new file mode 100644 index 000000000000..18a90e20a881 --- /dev/null +++ b/doc/release/next_whats_new/okabe_ito_colormap.rst @@ -0,0 +1,29 @@ +Okabe-Ito accessible colormap +----------------------------- + +Matplotlib now includes the Okabe-Ito colormap. This addition provides more accessibility for categorical color needs and makes it easier to produce figures that are readable for viewers with common forms of color vision deficiency. This color sequence is unambiguous regardless of whether the viewer has colorblindness and is reliably print-friendly. + +You can use the sequence anywhere a listed colormap or color cycle is accepted. It is available alongside other qualitative color sets as ``okabe_ito``. + +For example, to set it as the default colormap for your plots and image-like artists, use: + +.. code-block:: python + + import matplotlib.pyplot as plt + from cycler import cycler + + plt.rcParams['axes.prop_cycle'] = cycler('color', plt.colormaps['okabe_ito'].colors) + plt.rcParams['image.cmap'] = 'okabe_ito' + +Or, when creating plots, you can pass the colormap explicitly: + +.. plot:: + + import matplotlib.pyplot as plt + + colors = plt.colormaps['okabe_ito'].colors + x = range(5) + for i, c in enumerate(colors): + plt.plot(x, [v*(i+1) for v in x], color=c, label=f'line {i}') + plt.legend() + plt.show() From 5a9e61e1c1ad2259134e95f200227496581e7b2d Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Fri, 19 Dec 2025 01:21:25 +0100 Subject: [PATCH 12/13] Update doc/release/next_whats_new/okabe_ito_colormap.rst Changed title per @timhoffm recommendation. Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- doc/release/next_whats_new/okabe_ito_colormap.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/release/next_whats_new/okabe_ito_colormap.rst b/doc/release/next_whats_new/okabe_ito_colormap.rst index 18a90e20a881..35a005e72219 100644 --- a/doc/release/next_whats_new/okabe_ito_colormap.rst +++ b/doc/release/next_whats_new/okabe_ito_colormap.rst @@ -1,5 +1,5 @@ -Okabe-Ito accessible colormap ------------------------------ +Okabe-Ito accessible color sequence +----------------------------------- Matplotlib now includes the Okabe-Ito colormap. This addition provides more accessibility for categorical color needs and makes it easier to produce figures that are readable for viewers with common forms of color vision deficiency. This color sequence is unambiguous regardless of whether the viewer has colorblindness and is reliably print-friendly. From 0c39666fb6de14ee62267ceccd8dcf566686a27e Mon Sep 17 00:00:00 2001 From: brk <187102275+brooks-code@users.noreply.github.com> Date: Fri, 19 Dec 2025 02:44:52 +0000 Subject: [PATCH 13/13] Update whats new per @timhoffm suggestion --- doc/release/next_whats_new/okabe_ito_colormap.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/release/next_whats_new/okabe_ito_colormap.rst b/doc/release/next_whats_new/okabe_ito_colormap.rst index 35a005e72219..fad461257932 100644 --- a/doc/release/next_whats_new/okabe_ito_colormap.rst +++ b/doc/release/next_whats_new/okabe_ito_colormap.rst @@ -1,9 +1,9 @@ Okabe-Ito accessible color sequence ----------------------------------- -Matplotlib now includes the Okabe-Ito colormap. This addition provides more accessibility for categorical color needs and makes it easier to produce figures that are readable for viewers with common forms of color vision deficiency. This color sequence is unambiguous regardless of whether the viewer has colorblindness and is reliably print-friendly. +Matplotlib now includes the `Okabe-Ito color sequence`_. Its colors remain distinguishable for common forms of color-vision deficiency and when printed. -You can use the sequence anywhere a listed colormap or color cycle is accepted. It is available alongside other qualitative color sets as ``okabe_ito``. +.. _Okabe-Ito color sequence: https://jfly.uni-koeln.de/color/#pallet For example, to set it as the default colormap for your plots and image-like artists, use: @@ -15,7 +15,7 @@ For example, to set it as the default colormap for your plots and image-like art plt.rcParams['axes.prop_cycle'] = cycler('color', plt.colormaps['okabe_ito'].colors) plt.rcParams['image.cmap'] = 'okabe_ito' -Or, when creating plots, you can pass the colormap explicitly: +Or, when creating plots, you can pass it explicitly: .. plot::