Colorschemes

Plots supports all colorschemes from ColorSchemes.jl. They can be used as a gradient or as a palette and are passed as a symbol holding their name to cgrad or palette.

plot(
    [x -> sin(x - a) for a in range(0, π / 2, length = 5)], 0, 2π;
    palette = :Dark2_5,
)
function f(x, y)
    r = sqrt(x^2 + y^2)
    return cos(r) / (1 + r)
end
x = range(0, 2π, length = 30)
heatmap(x, x, f, c = :thermal)

ColorPalette

Plots chooses colors for series automatically from the palette passed to the color_palette attribute. The attribute accepts symbols of colorscheme names or ColorPalette objects. Color palettes can be constructed with palette(cs, [n]) where cs can be a Symbol, a vector of colors, a ColorScheme, ColorPalette or ColorGradient. The optional argument n decides how many colors to choose from cs.

palette(:tab10)
palette([:purple, :green], 7)

ColorGradient

For heatmap, surface, contour or line_z, marker_z and line_z Plots.jl chooses colors from a ColorGradient. If not specified, the default ColorGradient :inferno is used. A different gradient can be selected by passing a symbol for a colorscheme name to the seriescolor attribute. For more detailed configuration, the color attributes also accept a ColorGradient object. Color gradients can be constructed with

cgrad(cs, [z], alpha = nothing, rev = false, scale = nothing, categorical = nothing)

where cs can be a Symbol, a vector of colors, a ColorScheme, ColorPalette or ColorGradient.

cgrad(:acton)

You can pass a vector of values between 0 and 1 as second argument to specify positions of color transitions.

cgrad([:orange, :blue], [0.1, 0.3, 0.8])

With rev = true the colorscheme colors are reversed.

cgrad(:thermal, rev = true)

Setting categorical = true returns a CategoricalColorGradient that only chooses from a discrete set of colors without interpolating continuously. The optional second argument determines how many colors to choose from the colorscheme. They are distributed uniformly along the colorscheme colors.

cgrad(:matter, 5, categorical = true)

Categorical gradients also accept a vector for positions of color transitions and can be reversed.

cgrad(:matter, [0.1, 0.3, 0.8], rev = true, categorical = true)

The distribution of color selection can be scaled with the scale keyword argument which accepts :log, :log10, :ln, :log2, :exp or a function to be applied on the color position values between 0 and 1.

cgrad(:roma, scale = :log)

Categorical gradients can also be scaled.

cgrad(:roma, 10, categorical = true, scale = :exp)

Pre-defined ColorSchemes

misc

These colorschemes are not defined or provide different colors in ColorSchemes.jl They are kept for compatibility with Plots behavior before v1.1.0.

NamePaletteGradient
:default
:blues
:bluesreds
:darkrainbow
:darktest
:grays
:greens
:heat
:lightrainbow
:lighttest
:rainbow
:reds
:redsblues

The following colorschemes are defined by ColorSchemes.jl.

cmocean

NamePaletteGradient
:algae
:amp
:balance
:curl
:deep
:delta
:dense
:grays
:haline
:ice
:matter
:oxy
:phase
:solar
:speed
:tempo
:thermal
:turbid

scientific

NamePaletteGradient
:acton
:acton10
:acton100
:acton25
:acton50
:actonS
:bam
:bam10
:bam100
:bam25
:bam50
:bamO
:bamO10
:bamO100
:bamO25
:bamO50
:bamako
:bamako10
:bamako100
:bamako25
:bamako50
:bamakoS
:batlow
:batlow10
:batlow100
:batlow25
:batlow50
:batlowK
:batlowK10
:batlowK100
:batlowK25
:batlowK50
:batlowKS
:batlowS
:batlowW
:batlowW10
:batlowW100
:batlowW25
:batlowW50
:batlowWS
:berlin
:berlin10
:berlin100
:berlin25
:berlin50
:bilbao
:bilbao10
:bilbao100
:bilbao25