添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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.

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

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

  • What are the colors in the default palette for line graphs? Is the palette a well-known one?
  • Under what principle or in what scheme were these colors chosen?
  • 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.)

    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:

    Looks very like the default legend for a plot:

  • Is there a references or documentation for this particular palette?
  • Even better - the code itself… :slight_smile: After a bit of spelunking, I think the default palette is generated with this code:

    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(
            seed_colors,
            lchoices = Float64[lightness],
            cchoices = Float64[chroma],
            hchoices = range(0; stop = 340, length = 20),
        )[2:end]
        ColorScheme(colors)
    

    which generates this:

    which again looks very like the default.

  • 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, 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 cover most of the basics.

    If you want to create custom colorschemes, this is possible using functions from Colors.jl - or you could experiment with ColorSchemeTools.

    @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, seems more obvious.

    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