Makie plots with color cycles and color palettes

Makie seems really exciting, but when I tried it as part of my workflow, I found it lacks a rather basic feature.

It seems that Makie does not have working color cycles (automatically picking up a new color for each new line in a plot). The lack of automation does not bother me too much as even in matplotlib I frequently just put these colors by hand.

However, picking up custom but pretty colors from a palette seems very clunky (personal subjective opinion) and under documented (I think that is fairly objective). The majority of the examples in the gallery just use :red :blue :green which definitely detracts from the visual appeal and legibility.

In matplotlib I can pick the default palette and just use “C1”, “C2”, etc as references to these colors. What is the “standard” way in Makie to draw a couple of lines colored by colors from a pretty palette? Something that does not require boilerplate hopefully? Any chance this advice can be added to the tutorial/gallery instead of using the :red :green :blue lines? (Happy to make the edits if I know what the Makie invocation looks like)

2 Likes

These are some pages I went through before writing the post:

http://juliaplots.org/MakieReferenceImages/gallery/index.html and in particular the following examples:

https://github.com/JuliaPlots/Makie.jl/issues/189
https://github.com/JuliaPlots/AbstractPlotting.jl/pull/37

I don’t know what the reasons were that something like this wasn’t added before, but I’m currently trying to add attribute cycling in this PR.

It is a bit trickier than it looks on first glance if I try to make everything as customizable for the end user as possible while also making it simple to use.

https://github.com/JuliaPlots/AbstractPlotting.jl/pull/609

5 Likes

I am occasionally getting notifications from this old post, so I wanted to note:

Color cycles are now wonderfully supported by Makie

See Cyclers and Palettes in the following

https://docs.makie.org/v0.18.3/documentation/theming/index.html#cycles

1 Like