# Color-blind-friendly color sequence (palette) for line graphs

**URL:** <https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551>\
**Category:** Visualization\
**Tags:** question, color-theme\
**Created:** [January 5, 2023, 11:22am UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551 "2023-01-05T11:22:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [January 5, 2023, 11:22am UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/1 "2023-01-05T11:22:57Z")

</div>

I’d like to know “what” the default color sequence is for line graphs, such as the sample code below generates. In particular I’d like to know whether consideration has gone into the color palette about color blindness. If so, I’d like to read the description of the color sequence.

In this forum, there is at least one discussion thread about color-blind-friendliness among developers, but I’m not able to tell what was eventually agreed upon.

I started to read the source codes under `PlotThemes.jl` but I’m struggling to locate the place where the actual colors are defined. Maybe that’s the wrong place.

```julia
using Plots
a = rand(Float64, 20, 5)
plot(a; linewidth=3)

```

---

<div class="post-metadata">

**Author:** ![josuagrw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josuagrw/32/1015_2.png) [@josuagrw](https://discourse.julialang.org/u/josuagrw)\
**Post date:** [January 5, 2023, 12:33pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/2 "2023-01-05T12:33:44Z")

</div>

ColorCET is probably a good starting point. A lot of efforts are derived from that work

[https://colorcet.com/](https://colorcet.com/)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 5, 2023, 12:35pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/3 "2023-01-05T12:35:02Z")

</div>

See this [ColorSchemes.jl section](https://juliagraphics.github.io/ColorSchemes.jl/stable/basics/#For-CVD-(color-vision-deficient-or-%22color-blind:)-users) too.

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [January 5, 2023, 3:19pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/4 "2023-01-05T15:19:20Z")

</div>

Thank you folks, but it seems that I didn’t write my initial post clearly. I know those works you refer to (not those particular references, but the works those references are based on).

_All I want to find out is the description of the default palette._ (By extension, I’d also like to know what other palettes are.)

1. What are the colors in the default palette for line graphs? Is the palette a well-known one?
2. Under what principle or in what scheme were these colors chosen?
3. Is there a references or documentation for this particular palette?

For example, I use Viridis and Parula, which are color-blind-friendly and perceptually uniform, for my contour plots. I often use “Tol Bright”, which is included in the reference @rafael.guerra cites, for line graphs. Both are on a graphing app which isn’t Julia.

Julia’s default palette looks similar to Tol Bright but the order of the colors is different. (Come to think of it, order shouldn’t matter and Julia’s default may be To Bright.)

So, what is the default palette? (I’m willing to look into the source codes, if I know where to look.)

If there is no documentation for the default palette, I’d like to know how to plug in a custom palette. I’d use Tol Bright for my line graphs. (I’ll start to research into it tomorrow.)

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [January 6, 2023, 12:43pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/5 "2023-01-06T12:43:39Z")

</div>

> _All I want to find out is the description of the default palette._ … So, what is the default palette?

I think this is the default palette, according to the manual:

 ![Screenshot 2023-01-06 at 12.13.46](https://global.discourse-cdn.com/julialang/original/3X/8/9/8976d89743d4734b323c99d84ba1e4eebfcc0ef5.png)

Looks very like the default legend for a plot:

 ![Screenshot 2023-01-06 at 12.22.49](https://global.discourse-cdn.com/julialang/original/3X/8/5/85180a3320f99e3961fede40e2514276cf1c782d.png)

> 1. Is there a references or documentation for this particular palette?

Even better - the code itself… 🙂 After a bit of spelunking, I think the default palette is generated with [this code](https://github.com/JuliaPlots/PlotUtils.jl/blob/8e5021c17805eaf7b111cc1185208eba282a5cb1/src/color_utils.jl#L19):

```julia
function generate_colorscheme(
    bgcolor = plot_color(:white);
    color_bases = plot_color([colorant"steelblue", colorant"orangered"]),
    lightness = lightness_from_background(bgcolor),
    chroma = _lch_c_const[],
    n = 17,
)
    seed_colors = vcat(bgcolor, map(c -> adjust_lch(c, lightness, chroma), color_bases))
    seed_colors = convert(Vector{RGB{Float64}}, seed_colors)
    colors = distinguishable_colors(
        n,
        seed_colors,
        lchoices = Float64[lightness],
        cchoices = Float64[chroma],
        hchoices = range(0; stop = 340, length = 20),
    )[2:end]
    ColorScheme(colors)
end

```

which generates this:

 ![Screenshot 2023-01-06 at 12.21.31](https://global.discourse-cdn.com/julialang/original/3X/d/a/da4e1553556821e70bc04e0c29e699f89c6e2c40.png)

which again looks very like the default.

> 1. Under what principle or in what scheme were these colors chosen?

Well, Plots.jl has quite a long and interesting history - quite a few things have been discussed in the 2,500 or so issues on [github.com](http://github.com), and many people have contributed to its development over the years. If you search through the issues, you’ll find many discussions about many aspects of plot generation. But I’d guess that using `Colors.distinguishable_colors` was a reasonable principle to adopt at the time.

> I’d like to know how to plug in a custom palette

I think the [docs](https://docs.juliaplots.org/dev/generated/colorschemes/) cover most of the basics.

If you want to create custom colorschemes, this is possible using functions from [Colors.jl](https://juliagraphics.github.io/Colors.jl/dev/colormapsandcolorscales/) - or you could experiment with [ColorSchemeTools](https://github.com/JuliaGraphics/ColorSchemeTools.jl).

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 6, 2023, 1:10pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/6 "2023-01-06T13:10:51Z")

</div>

@cormullion, there was probably a lot of science in that palette, but it’s pretty weird…  
Something like this [List of 20 Simple, Distinct Colors](https://sashamaps.net/docs/resources/20-colors/), seems more obvious.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [January 6, 2023, 1:50pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/7 "2023-01-06T13:50:25Z")

</div>

Thought Experiment: Lock 100 data scientists in a room; let them out once they’ve all agreed on the perfect color palette. 😀

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [January 6, 2023, 3:08pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/8 "2023-01-06T15:08:29Z")

</div>

Okay, it seems that I have to drastically simplify my question.

- Is the default palette of `Plots` color-blind-friendly? That is, is it designed to maximize distinction between colors for typical color-blind people?

Where can I find the answer to this question?

. . . But it seems to me that the answer is yes and no . . . I’ve tested the generated palette (Thanks, @cormullion !) on

> **[Color Blind Vision Simulator | Color Blind Glasses Simulator](https://pilestone.com/pages/color-blindness-simulator-1)**
>
> Just what do color blind people see? To help you experience what those suffering with color blindness see, try out Pilestone’s color blind image simulator.

and found a typical color-blind person can tell the first 7 colors apart but if you include the remaining colors, some of the colors look alike.

So, my guess is that it’s designed to be color-blind friendly as long as you stick to the first 7 colors. The first 7 colors look similar to “Tol Bright” (see below) though in a different order.

You or we definitely need a documentation that discusses this property of the default palette. The above is just my guess. We’d need to track down the person who wrote the code and ask her/him to describe the palette. How do I go about it?

* * *

The following discussion is now moot.

“Is there a references or documentation for this particular palette?”

> Even better - the code itself

I’m afraid it’s not! I’m looking for a reference like this

> **[Color blind friendly palettes for data visualizations with categories](https://thenode.biologists.com/data-visualization-with-flying-colors/research/)**
>
> A discussion of color blind friendly palettes for labeling unique catergories in data visualization.

This article clearly describes how and for what purposes the palettes like “Tol Bright” have been constructed and what properties they have.

When I said I don’t mind reading the source code, I imagined references would be found in the comments! If I were to write a code to construct a palette, I would write it as

```julia
# The default palette is based on "Tol Bright"
# (https://thenode.biologists.com/data-visualization-with-flying-colors/research/).
# The original palette has only 7 colors. In the following code, I increase it to 12
# by such and such a method. This somewhat decreases distinctiveness, but I've
# checked the result using the color-blind simulator (https://sample.org/ . . . )
# and it looked fine.
# . . .

```

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [January 6, 2023, 3:49pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/9 "2023-01-06T15:49:31Z")

</div>

> [@ryofurue](#):
>
> Is the default palette of `Plots` color-blind-friendly? That is, is it designed to maximize distinction between colors for typical color-blind people?

Are you kidding? I’m not colorblind and I can’t even distinguish between anything after the first 7. But I think using too many colors in one plot is bad. I would stick to 4/5 at most and then start varying line styles if needed (actually I prefer to vary line styles first to make the plots bw printer friendly).

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [January 6, 2023, 4:05pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/10 "2023-01-06T16:05:42Z")

</div>

> <https://github.com/GenericMappingTools/GMT.jl/blob/master/src/utils_types.jl#L393>

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [January 6, 2023, 7:22pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/11 "2023-01-06T19:22:36Z")

</div>

> Are you kidding? I’m not colorblind and I can’t even distinguish between anything after the first 7.

I apologize if I offended you for some reason, but honestly I don’t understand what you are attacking.

If you don’t choose the colors carefully, even the first 7 colors may not be distinguishable to color blind people. That’s the point of the newer color schemes like those Paul Tol constructed. In that sense, Julia’s default color scheme is an improvement over the traditional red, blue, green, . . . scheme.

Then the additional colors Julia offers represent somebody’s efforts to add more colors that are distinguishable to people with normal vision . . . that’s my guess. And I believe your

> “I can’t even distinguish between anything after the first 7”

is an exaggeration. At least _I_ can distinguish them if I look carefully.

So, Julia’s default color scheme seems to represent best efforts by somebody, to maximize its utility both to color-blind people and to people with normal vision.

All I’m asking for is a documentation that summarizes these efforts.

* * *

The following is a tangential issue:

> I would stick to 4/5 at most and then start varying line styles if needed

I agree. I wish that were the default behavior. The point of default is to produce as legible a result as possible without user intervention.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [January 6, 2023, 7:40pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/12 "2023-01-06T19:40:31Z")

</div>

Not attacking anyone – I was being facetious. And what I meant about beyond 7 was that for example if you include 5/8/10 in the same plot (with or without other colors), it would be nearly indistinguishable. Or 1 and 13.

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [January 6, 2023, 8:13pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/13 "2023-01-06T20:13:09Z")

</div>

> [@ryofurue](#):
>
> All I’m asking for is a documentation that summarizes these efforts.

It is possible that the colorscheme was not designed with this in mind, an there may not be such a documentation already written. The piece of code referenced earlier was commited by @daschw some maybe he has some insight?

However, I agree it would be a nice discussion to have in the Plots.jl github repo, although we should not lose sight that while it is the default, it is always easy to select any other colorscheme so while I do think that the the default is important it may not be THAT important.

P.S  
Regarding this comment

> [@ryofurue](#):
>
> So, Julia’s default color scheme seems to represent best efforts by somebody, to maximize its utility both to color-blind people and to people with normal vision.

Be wary that this is not “Julia’s default scheme” but rather Plots.jl default scheme. While Plots.jl is a prominent plotting package is not integrated in the julia language. Other plotting packages have different defaults. For example, Makie uses the so-colled “Wong colors” from here [Points of view: Color blindness | Nature Methods](https://www.nature.com/articles/nmeth.1618) (but that were originally published by Masataka Okabe & Kei Ito in 2003).

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [January 6, 2023, 8:17pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/14 "2023-01-06T20:17:28Z")

</div>

By the way. I found this discussion in Plots’ repository, it may be interesting to take a look at it:

> <https://github.com/JuliaPlots/Plots.jl/issues/1144>
>
> I think it would be a good thing to have a default palette that works for everyo…ne -- the current palette is not good for this (after running some plots through a simulator).
> 
> I would suggest to replace the default by: 
> 
> !\[palette\](http://mkweb.bcgsc.ca/colorblind/img/colorblindness.palettes.trivial.png)
> 
> In fact, if you tell me where to make the change, I'll be glad to submit a PR.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 6, 2023, 9:08pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/15 "2023-01-06T21:08:58Z")

</div>

> [@cormullion](#):
>
> Thought Experiment: Lock 100 data scientists in a room; let them out once they’ve all agreed on the perfect color palette.

So either they are colorblind or they are crazy:

 ![Plots_default_16_distinguishable_colors_vs_Trubetskoy_20_colors](https://global.discourse-cdn.com/julialang/original/3X/8/c/8c1839c7c7eec71d20024f6a7c2b7f1771cc1cc4.jpeg)

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [January 9, 2023, 2:34pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/16 "2023-01-09T14:34:06Z")

</div>

Thank you everyone for helping. Sorry I don’t have much time right now to address all comments. I intend to come back in several weeks.

Perhaps I should have explained why I need the documentation in the first place.

I plot 10 curves in 10 different colors using the `Plots` package’s default. As you can imagine, it’s not easy to distinguish them. But the purpose of the plot is to show the reader general properties of the 10 curves, and for this very reason, I don’t want to use thick lines, symbols, or dashes, because those distinctions would emphasize some curves and de-emphasize some others curves.

So, the ability to distinguish the colors isn’t a primary concern for this particular plot. Still, it would be nice if the interested reader can distinguish the curves even if that would require zooming into the plot and carefully comparing the lines against the legend. The reader might want to do this for a purpose I don’t foresee.

I submitted a paper including this plot. Then a reviewer casually asks to improve the color scheme of the plot. I plan to answer that there are better color schemes for people with normal vision but to be inclusive for color blind people, probably this is the best, or at least one of the best color schemes.

To write this answer, I wanted a documentation of this particular palette. As @joa-quim kindly shows, [List of 20 Simple, Distinct Colors | Sasha Trubetskoy](https://sashamaps.net/docs/resources/20-colors/)  
is the documentation I’ve been looking for. Unfortunately the document touches upon color blindness only in general terms. But as I said before, I tested the scheme at a color-blind simulator and saw that at least the first 7 colors must have been designed color blindness in mind.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [January 9, 2023, 3:15pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/17 "2023-01-09T15:15:09Z")

</div>

> [@ryofurue](#):
>
> As @joa-quim kindly shows, [List of 20 Simple, Distinct Colors | Sasha Trubetskoy](https://sashamaps.net/docs/resources/20-colors/)

The first link was from @rafael.guerra

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [January 9, 2023, 5:09pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/18 "2023-01-09T17:09:45Z")

</div>

To setup a colorblind friendly palette you can read a few journal papers on this topic. In this way you can select colors based on rigorous, scientific arguments.  
[https://www.nature.com/articles/d41586-021-02696-z](https://www.nature.com/articles/d41586-021-02696-z)  
[https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0249755](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0249755)  
and this older (2018) paper, by the cividis colormap authors:  
[[Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239)

Trubeskoy’s colors are distinguishable for people with “normal” vision, but according to standards for colorblind friendly palettes, some of his colors are too bright.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 9, 2023, 5:47pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/19 "2023-01-09T17:47:35Z")

</div>

> [@empet](#):
>
> Trubeskoy’s colors are distinguishable for people with “normal” vision

In his site, Trubeskoy provides palettes for 95%, 99%, 99.99% and 100% population accessibility.

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [January 9, 2023, 5:58pm UTC](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551/20 "2023-01-09T17:58:34Z")

</div>

Yes he did, but without arguments. Are there posted somewhere the results of his experiments, the sample size, questions addressed to participants?

[Next page](https://discourse.julialang.org/t/color-blind-friendly-color-sequence-palette-for-line-graphs/92551.md?page=2)
