Predefined themes
Makie has a few predefined themes. Here you can see the same example figure with these different themes applied.
julia
using CairoMakie
using Random
function demofigure()
Random.seed!(2)
f = Figure()
ax = Axis(f[1, 1],
title = "measurements",
xlabel = "time (s)",
ylabel = "amplitude")
labels = ["alpha", "beta", "gamma", "delta", "epsilon", "zeta"]
for i in 1:6
y = cumsum(randn(10)) .* (isodd(i) ? 1 : -1)
lines!(y, label = labels[i])
scatter!(y, label = labels[i])
end
Legend(f[1, 2], ax, "legend", merge = true)
Axis3(f[1, 3],
viewmode = :stretch,
zlabeloffset = 40,
title = "sinusoid")
s = surface!(0:0.5:10, 0:0.5:10, (x, y) -> sqrt(x * y) + sin(1.5x))
Colorbar(f[1, 4], s, label = "intensity")
ax = Axis(f[2, 1:2],
title = "different species",
xlabel = "height (m)",
ylabel = "density",)
for i in 1:6
y = randn(200) .+ 2i
density!(y)
end
tightlimits!(ax, Bottom())
xlims!(ax, -1, 15)
Axis(f[2, 3:4],
title = "stock performance",
xticks = (1:6, labels),
xlabel = "company",
ylabel = "gain (\$)",
xticklabelrotation = pi/6)
for i in 1:6
data = randn(1)
barplot!([i], data)
rangebars!([i], data .- 0.2, data .+ 0.2)
end
f
end
demofigure (generic function with 1 method)
Default theme
julia
demofigure()
![](/v0.21/assets/fbac891.BvcxNmOs.png)
theme_ggplot2
julia
with_theme(demofigure, theme_ggplot2())
![](/v0.21/assets/62d684a.DIqNa5wo.png)
theme_minimal
julia
with_theme(demofigure, theme_minimal())
![](/v0.21/assets/1e92b6a.DCyMEp7s.png)
theme_black
julia
with_theme(demofigure, theme_black())
![](/v0.21/assets/c14a278.Cvnl4tTt.png)
theme_light
julia
with_theme(demofigure, theme_light())
![](/v0.21/assets/8a0a523.W8POcNXd.png)
theme_dark
julia
with_theme(demofigure, theme_dark())
![](/v0.21/assets/bd03316.BYKIgsj5.png)
theme_latexfonts
See also more general documentation on Makie and LaTeX.
julia
with_theme(demofigure, theme_latexfonts())
![](/v0.21/assets/3a85860.DhLGcCCR.png)