Color gradients in Plots are arranged into color libraries. You don’t need to know or specify the color library to pick a color scheme, but they are useful for exploration. To get a list of all color libraries in Plots, use the clibraries
function:
julia> clibraries()
5-element Array{Symbol,1}:
:Plots
:cmocean
:misc
:colorcet
:colorbrewer
All but the :misc
library are restricted to colorgradients that live up to the perceptual uniformity standards for scientific visualization (so you’ll have to look in the :misc
library for a rainbow gradient). The Plots color library is loaded by default.
You can get a list of colorschemes in each gradient by calling e.g. cgradients(:colorcet)
. Or, you can use the showlibrary
function to get a visual representation, e.g.
showlibrary(:Plots)
Each color library also defines a default gradient (:magma
in the case of :Plots
), a :sequential
gradient, and a :diverging
gradient (for color gradients that are brightest in the middle - in :Plots
this is the :pu_or
gradient).
You can change the active color library by clibrary(:colorbrewer)
. You can use any color gradient regardless of library by passing its name to the color
attribute in Plots, but in case of namespace clashes (e.g. there are multiple :blues
) it will default to the one in the current library.
I should add that you can reverse any color gradient by appending “_r”, e.g. :viridis_r
.
I would strongly recommend exploring the :colorbrewer
(from here), :colorcet
(from e.g. here) and :cmocean
(from here) libraries, they are very nice.