Colors

Makie has support for you to color your plots however you want to. You can manipulate the color of a plot by using the color keyword, and change the colormap by using the colormap keyword.

For line plots, you can provide a single color or symbol that will color the entire line, or you can provide an array of values that map to colors using a colormap.

Any color symbol supported by Colors.jl is supported, check out their page on named colors to see what you can get away with! You can also pass RGB or RGBA values.

Colormaps

Colormaps are mappings of values to colors. You can supply the coloring values using the color keyword argument, and the colormap will automatically be adjusted to fit those values. The default colormap is viridis, which looks like this:

Viridis colormap

You can copy this code and substitute cmap with any Colormap to show the colormap.

Makie supports multiple colormap libraries. Currently, support for colormaps provided by PlotUtils is inbuilt, meaning that any colormap symbol that works with Plots will also work with Makie. Colormaps from the ColorSchemes package can be used by colormap = ColorSchemes.<name of colormap>.colors. Similarly, colormaps from the PerceptualColourMaps package (which is a superset of the colorcet library) can be used by colormap = PerceptualColourMaps.cgrad("<name of colormap>"). In principle, any Array of RGB values can be used as a colormap.

Builtins

Makie relies on PlotUtils for colormap support, so all of Plots' colormap features are supported here. There are many ways of specifying a colormap:

  • You can pass a Symbol or String corresponding to a colormap name.
  • You can pass a Vector{Colorant} (which can be anything that Colors.jl can parse to a color).
  • You can pass the result of calling the cgrad(colors, [values]; categorical, scale, rev, alpha) function. This allows you to customize your colormap in many ways; see the documentation (by ?cgrad) for more detail on the available options.

Colormaps can be reversed by Reverse(:<gradient_name>). The colorrange::NTuple{2,Number} attribute can be used to define the data values that correspond with the ends of the colormap.

See Colormap reference for a table enumerating all available colormaps.

Colormap reference

misc

These colorschemes are not defined or provide different colors in ColorSchemes.jl They are kept for compatibility with the old behaviour of Makie, before v0.10.

NAMECategorical variantContinuous variant
:default | |
:blues | |
:bluesreds | |
:cividis | |
:darkrainbow | |
:darktest | |
:grays | |
:greens | |
:heat | |
:lightrainbow | |
:lighttest | |
:rainbow | |
:reds | |
:redsblues | |

The following colorschemes are defined by ColorSchemes.jl.

cmocean

NAMECategorical variantContinuous variant
:algae | |
:amp | |
:balance | |
:curl | |
:deep | |
:delta | |
:dense | |
:grays | |
:haline | |
:ice | |
:matter | |
:oxy | |
:phase | |
:solar | |
:speed | |
:tempo | |
:thermal | |
:turbid | |

scientific

NAMECategorical variantContinuous variant
:acton | |
:bamako | |
:batlow | |
:berlin | |
:bilbao | |
:broc | |
:brocO | |
:buda | |
:cork | |
:corkO | |
:davos | |
:devon | |
:grayC | |
:hawaii | |
:imola | |
:lajolla | |
:lapaz | |
:lisbon | |
:nuuk | |
:oleron | |
:oslo | |
:roma | |
:romaO | |
:tofino | |
:tokyo | |
:turku | |
:vik | |
:vikO | |

matplotlib

NAMECategorical variantContinuous variant
:Wistia | |
:autumn1 | |
:binary | |
:bone | |
:bone_1 | |
:brg | |
:bwr | |
:cool | |
:coolwarm | |
:copper | |
:flag | |
:gist_earth | |
:gist_gray | |
:gist_heat | |
:gist_ncar | |
:gist_rainbow | |
:gist_stern | |
:gist_yarg | |
:gray1 | |
:hot | |
:hsv | |
:inferno | |
:jet1 | |
:magma | |
:nipy_spectral | |
:pink | |
:plasma | |
:prism | |
:seismic | |
:spring | |
:summer