Skip to content

MakieOrg/MakieThemes.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MakieThemes

Stable Dev Build Status

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()

default

Using the :fresh theme from GGThemr;

using MakieThemes
MakieThemes.demoscatter(theme_ggthemr(:fresh))

ggthemr

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

MakieThemes

This is the target theme I'm aiming for (image created with R) GGThemr in R

Color v/s style themes

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

Current issues:

  • axis line thickness
  • the period of the dashed line