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.

Colors

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.

Color legends

To show the colormap and its scaling, you can use a color legend. Color legends can be automatically produced by the colorlegend function, to which a Plot object must be passed. Its range and the colormap it shows can also be manually altered, as can many of its attributes.

To simply produce a color legend and plot it to the left of the original plot, you can produce a colorlegend and vbox it.

using Makie
using ColorSchemes      # colormaps galore

t = range(0, stop=1, length=500) # time steps

θ = (6π) .* t    # angles

x = t .* cos.(θ) # x coords of spiral
y = t .* sin.(θ) # y coords of spiral

p1 = lines(
    x,
    y,
    color = t,
    colormap = ColorSchemes.magma.colors,
    linewidth=8)

cm = colorlegend(
    p1[end],             # access the plot of Scene p1
    raw = true,          # without axes or grid
    camera = campixel!,  # gives a concrete bounding box in pixels
                            # so that the `vbox` gives you the right size
    width = (            # make the colorlegend longer so it looks nicer
        30,              # the width
        540              # the height
    )
    )

scene_final = vbox(p1, cm) # put the colorlegend and the plot together in a `vbox`
Scene (960px, 540px):
  0 Plots
  2 Child Scenes:
    ├ Scene (862px, 540px)
    └ Scene (98px, 540px)

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
:gray
: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
:tab10
:tab20
:tab20b
:tab20c
:terrain
:twilight
:viridis
:winter

colorbrewer

NAMECategorical variantContinuous variant
:Accent_3
:Accent_4
:Accent_5
:Accent_6
:Accent_7
:Accent_8
:Blues_3
:Blues_4
:Blues_5
:Blues_6
:Blues_7
:Blues_8
:Blues_9
:BrBG_10
:BrBG_11
:BrBG_3
:BrBG_4
:BrBG_5
:BrBG_6
:BrBG_7
:BrBG_8
:BrBG_9
:BuGn_3
:BuGn_4
:BuGn_5
:BuGn_6
:BuGn_7
:BuGn_8
:BuGn_9
:BuPu_3
:BuPu_4
:BuPu_5
:BuPu_6
:BuPu_7
:BuPu_8
:BuPu_9
:Dark2_3
:Dark2_4
:Dark2_5
:Dark2_6
:Dark2_7
:Dark2_8
:GnBu_3
:GnBu_4
:GnBu_5
:GnBu_6
:GnBu_7
:GnBu_8
:GnBu_9
:Greens_3
:Greens_4
:Greens_5
:Greens_6
:Greens_7
:Greens_8
:Greens_9
:Greys_3
:Greys_4
:Greys_5
:Greys_6
:Greys_7
:Greys_8
:Greys_9
:OrRd_3
:OrRd_4
:OrRd_5
:OrRd_6
:OrRd_7
:OrRd_8
:OrRd_9
:Oranges_3
:Oranges_4
:Oranges_5
:Oranges_6
:Oranges_7
:Oranges_8
:Oranges_9
:PRGn_10
:PRGn_11
:PRGn_3
:PRGn_4
:PRGn_5
:PRGn_6
:PRGn_7
:PRGn_8
:PRGn_9
:Paired_10
:Paired_11
:Paired_12
:Paired_3
:Paired_4
:Paired_5
:Paired_6
:Paired_7
:Paired_8
:Paired_9
:Pastel1_3
:Pastel1_4
:Pastel1_5
:Pastel1_6
:Pastel1_7
:Pastel1_8
:Pastel1_9
:Pastel2_3
:Pastel2_4
:Pastel2_5
:Pastel2_6
:Pastel2_7
:Pastel2_8
:PiYG_10
:PiYG_11
:PiYG_3
:PiYG_4
:PiYG_5
:PiYG_6
:PiYG_7
:PiYG_8
:PiYG_9
:PuBuGn_3
:PuBuGn_4
:PuBuGn_5
:PuBuGn_6
:PuBuGn_7
:PuBuGn_8
:PuBuGn_9
:PuBu_3
:PuBu_4
:PuBu_5
:PuBu_6
:PuBu_7
:PuBu_8
:PuBu_9
:PuOr_10
:PuOr_11
:PuOr_3
:PuOr_4
:PuOr_5
:PuOr_6
:PuOr_7
:PuOr_8
:PuOr_9
:PuRd_3
:PuRd_4
:PuRd_5
:PuRd_6
:PuRd_7
:PuRd_8
:PuRd_9
:Purples_3
:Purples_4
:Purples_5
:Purples_6
:Purples_7
:Purples_8
:Purples_9
:RdBu_10
:RdBu_11
:RdBu_3
:RdBu_4
:RdBu_5
:RdBu_6
:RdBu_7
:RdBu_8
:RdBu_9
:RdGy_10
:RdGy_11
:RdGy_3
:RdGy_4
:RdGy_5
:RdGy_6
:RdGy_7
:RdGy_8
:RdGy_9
:RdPu_3
:RdPu_4
:RdPu_5
:RdPu_6
:RdPu_7
:RdPu_8
:RdPu_9
:RdYlBu_10
:RdYlBu_11
:RdYlBu_3
:RdYlBu_4
:RdYlBu_5
:RdYlBu_6
:RdYlBu_7
:RdYlBu_8
:RdYlBu_9
:RdYlGn_10
:RdYlGn_11
:RdYlGn_3
:RdYlGn_4
:RdYlGn_5
:RdYlGn_6
:RdYlGn_7
:RdYlGn_8
:RdYlGn_9
:Reds_3
:Reds_4
:Reds_5
:Reds_6
:Reds_7
:Reds_8
:Reds_9
:Set1_3
:Set1_4
:Set1_5
:Set1_6
:Set1_7
:Set1_8
:Set1_9
:Set2_3
:Set2_4
:Set2_5
:Set2_6
:Set2_7
:Set2_8
:Set3_10
:Set3_11
:Set3_12
:Set3_3
:Set3_4
:Set3_5
:Set3_6
:Set3_7
:Set3_8
:Set3_9
:Spectral_10
:Spectral_11
:Spectral_3
:Spectral_4
:Spectral_5
:Spectral_6
:Spectral_7
:Spectral_8
:Spectral_9
:YlGnBu_3
:YlGnBu_4
:YlGnBu_5
:YlGnBu_6
:YlGnBu_7
:YlGnBu_8
:YlGnBu_9
:YlGn_3
:YlGn_4
:YlGn_5
:YlGn_6
:YlGn_7
:YlGn_8
:YlGn_9
:YlOrBr_3
:YlOrBr_4
:YlOrBr_5
:YlOrBr_6
:YlOrBr_7
:YlOrBr_8
:YlOrBr_9
:YlOrRd_3
:YlOrRd_4
:YlOrRd_5
:YlOrRd_6
:YlOrRd_7
:YlOrRd_8
:YlOrRd_9

gnuplot

NAMECategorical variantContinuous variant
:afmhot
:gnuplot
:gnuplot2
:ocean
:rainbow1

colorcet

NAMECategorical variantContinuous variant
:cyclic_grey_15_85_c0_n256
:cyclic_grey_15_85_c0_n256_s25
:cyclic_mrybm_35_75_c68_n256
:cyclic_mrybm_35_75_c68_n256_s25
:cyclic_mygbm_30_95_c78_n256
:cyclic_mygbm_30_95_c78_n256_s25
:cyclic_wrwbw_40_90_c42_n256
:cyclic_wrwbw_40_90_c42_n256_s25
:diverging_bkr_55_10_c35_n256
:diverging_bky_60_10_c30_n256
:diverging_bwr_40_95_c42_n256
:diverging_bwr_55_98_c37_n256
:diverging_cwm_80_100_c22_n256
:diverging_gkr_60_10_c40_n256
:diverging_gwr_55_95_c38_n256
:diverging_gwv_55_95_c39_n256
:diverging_isoluminant_cjm_75_c23_n256
:diverging_isoluminant_cjm_75_c24_n256
:diverging_isoluminant_cjo_70_c25_n256
:diverging_linear_bjr_30_55_c53_n256
:diverging_linear_bjy_30_90_c45_n256
:diverging_rainbow_bgymr_45_85_c67_n256
:isoluminant_cgo_70_c39_n256
:isoluminant_cgo_80_c38_n256
:isoluminant_cm_70_c39_n256
:linear_bgy_10_95_c74_n256
:linear_bgyw_15_100_c67_n256
:linear_bgyw_15_100_c68_n256
:linear_blue_5_95_c73_n256
:linear_blue_95_50_c20_n256
:linear_bmw_5_95_c86_n256
:linear_bmw_5_95_c89_n256
:linear_bmy_10_95_c71_n256
:linear_bmy_10_95_c78_n256
:linear_gow_60_85_c27_n256
:linear_gow_65_90_c35_n256
:linear_green_5_95_c69_n256
:linear_grey_0_100_c0_n256
:linear_grey_10_95_c0_n256
:linear_kry_5_95_c72_n256
:linear_kry_5_98_c75_n256
:linear_kryw_0_100_c71_n256
:linear_kryw_5_100_c64_n256
:linear_kryw_5_100_c67_n256
:linear_ternary_blue_0_44_c57_n256
:linear_ternary_green_0_46_c42_n256
:linear_ternary_red_0_50_c52_n256
:rainbow_bgyr_35_85_c72_n256
:rainbow_bgyr_35_85_c73_n256
:rainbow_bgyrm_35_85_c69_n256
:rainbow_bgyrm_35_85_c71_n256

seaborn

NAMECategorical variantContinuous variant
:seaborn_bright
:seaborn_bright6
:seaborn_colorblind
:seaborn_colorblind6
:seaborn_dark
:seaborn_dark6
:seaborn_deep
:seaborn_deep6
:seaborn_icefire_gradient
:seaborn_muted
:seaborn_muted6
:seaborn_pastel
:seaborn_pastel6
:seaborn_rocket_gradient

general

NAMECategorical variantContinuous variant
:CMRmap
:alpine
:aquamarine
:army
:atlantic
:auerbach
:aurora
:autumn
:avocado
:beach
:blackbody
:bluegreenyellow
:bosch_garden
:bosch_hell
:botticelli
:brass
:browncyan
:canaletto
:candy
:cezanne
:cherry
:cmyk
:coffee
:cubehelix
:darkrainbow
:darkterrain
:deepsea
:fall
:fruitpunch
:fuchsia
:grays
:grayyellow
:greenbrownterrain
:greenpink
:hokusai
:holbein
:island
:jet
:julia_colorscheme
:klimt
:lake
:leonardo
:lighttemperaturemap
:lightterrain
:mint
:munch
:neon
:pastel
:pearl
:picasso
:pigeon
:plum
:rainbow
:redblue
:redgreensplit
:rembrandt
:rose
:rust
:sandyterrain
:sienna
:southwest
:starrynight
:sun
:sunset
:temperaturemap
:thermometer
:turbo
:valentine
:vangogh
:vermeer
:watermelon