The idea of this package is to create a collection of themes for Makie to customize the size and look of plot elements and colors. It will initially focus on porting themes from existing plotting packages.
Currently, we provide the following libraries:
GGThemr
- inspired by ggthemr, a R library for ggplot themes.BBC
- emulating the BBC's plot style, found in bbplot.
We do plan to add more themes, and PRs are welcome!
Here's the current default look of Makie:
using Makie, MakieThemes
Makie.demoscatter()
Using the :fresh
theme from GGThemr
;
using MakieThemes
MakieThemes.demoscatter(theme_ggthemr(:fresh))
Here's an expanded visualization based on the examples in the source theme:
Code
using CSV, DataFrames, MakieThemes, Makie, AlgebraOfGraphics
for dataset ∈ (:www, :drivers, :mtcars, :diamonds)
@eval $(dataset) = CSV.read(dirname(pathof(MakieThemes))*"/../data/"*$(string(dataset))*".tsv", delim = '\t', DataFrame)
end
Makie.set_theme!(ggthemr(:fresh))
fig = Figure()
www_plot = data(www) * mapping(:Minute, :Users, color = :Measure) * (visual(Lines) + visual(Scatter) * mapping(marker = :Measure))
www_grid = draw!(fig[1, 1], www_plot)
legend!(fig[1, 1, Top()], www_grid; orientation = :horizontal, titleposition = :left)
mtcars_plot = data(mtcars) * mapping(:mpg, color = :cyl => nonnumeric) * AlgebraOfGraphics.density()
mtcars_grid = draw!(fig[1, 2], mtcars_plot)
legend!(fig[1, 2, Top()], mtcars_grid; orientation = :horizontal, titleposition = :left)
diamonds_plot = data(diamonds) * mapping(:price, color = :cut, stack = :cut) * AlgebraOfGraphics.histogram()
draw!(fig[2, 1], diamonds_plot; axis = (xtickformat = x -> string.(round.(Int, x)),))
drivers_plot = data(drivers) * mapping(:Year, :Deaths) * visual(BoxPlot)
draw!(fig[2, 2], drivers_plot)
fig
This is the target theme I'm aiming for (image created with R)
In MakieThemes, we try to maintain a separation between color themes (dark v/s light theme, background colors, palettes, etc) and style themes (fonts, grid styles, title alignments, etc). This provides a lot of flexibility - you might
- axis line thickness
- the period of the dashed line