I’m happy to announce the prerelease (still to be merged in METADATA) of StatsMakie. StatsMakie provides recipes for statistical visualizations, built on top of Makie, as well as an API inspired on grammar of graphics to plot from a dataset.
Even though many such packages exist, I feel that StatsMakie is a bit different in that it combines “grammar of graphics”-like interface with high-performance 2D/3D plotting and support for custom julia types (the trade-off of course is lack of polish compared to more established alternatives).
StatsMakie mainly provides:
- support for default plotting of statistical objects (histograms, kernel densities, distributions, qqpairs)
- statistical plotting recipes (boxplot, violin)
- support for plotting from a dataset, referring to columns by name or number
- support for styling attributes according to values of variables in the dataset
- a “split-apply-combine” strategy for plots, where the data is grouped by an arbitrary number of columns(which are then used to style different attributes using a global palette but custom values can be provided) and then the result of each group is either plotted as is, or after applying a function to it, called “analysis”
- different default “analyses” (histogram, density, linear and non-linear regression)
- support for theming: many themes are available from the package MakieThemes to change the default palettes consistently across plots.
The following screenshot illustrates many of these features, using the custom theme “fresh”:
p1 = scatterlines(Data(www), :Minute, :Users, Group(color = :Measure, marker = :Measure), markersize = 6, marker = [:rect, :circle]) p2 = plot(density, Data(mtcars), :mpg, Group(color = :cyl)) p3 = plot(Position.stack, histogram, Data(diamonds), :price, Group(color = :cut)); p4 = boxplot(Data(drivers), :Year, :Deaths) vbox(hbox(p1, p2), hbox(p3, p4))
Online demo / article
The basic mechanisms of StatsMakie and a demo of its features are available as a NextJournal article. You can go through it and either remix it in the NextJournal platform or try and reproduce it locally.
As the release has not yet been merged and things are still settling down, to install the package type:
(v1.0) pkg> add AbstractPlotting#master GLMakie#master https://github.com/JuliaPlots/StatsMakie.jl.git
using AbstractPlotting, GLMakie, StatsMakie
to get started.
Many important features are still missing and there are still some hiccups with scaling (as you can see from the demo plot above, the font size is not consistent) that will get fixed as Makie and StatsMakie mature.
Even though it’s a bit early to use the package for production, it’s probably a very good time to try it out and give feedback / contribute!