ANN: StatsMakie prerelease for statistical and data visualizations

package
announcement
plotting

#1

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

Features

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.

Set up

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

and then:

using AbstractPlotting, GLMakie, StatsMakie

to get started.

Caveats

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!


#2

Great news.

But I’m trying to install it on Julia 1.0 Windows 10 and I get errors. I’ve had to do it as administrator otherwise GDAL wasn’t able to create a dll library.

I’ve done:
]

add AbstractPlotting#master GLMakie#master https://github.com/JuliaPlots/StatsMakie.jl.git

That worked well but

using AbstractPlotting, GLMakie, StatsMakie
[ Info: Precompiling GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a]
ERROR: LoadError: UndefVarError: AbstractBackend not defined
Stacktrace:
 getproperty(::Module, ::Symbol) at .\sysimg.jl:13
 top-level scope at none:0
 include at .\boot.jl:317 [inlined]
 include_relative(::Module, ::String) at .\loading.jl:1044
 include(::Module, ::String) at .\sysimg.jl:29
 top-level scope at none:2
 eval at .\boot.jl:319 [inlined]
 eval(::Expr) at .\client.jl:393
 top-level scope at .\none:3
in expression starting at C:\Users\joe\.julia\packages\GLMakie\Spqgl\src\GLMakie.jl:21
ERROR: Failed to precompile GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a] to C:\Users\joe\.julia\compiled\v1.0\GLMakie\nfnZR.ji.
Stacktrace:
 error(::String) at .\error.jl:33
 macro expansion at .\logging.jl:311 [inlined]
 compilecache(::Base.PkgId, ::String) at .\loading.jl:1190
 macro expansion at .\logging.jl:309 [inlined]
 _require(::Base.PkgId) at .\loading.jl:947
 require(::Base.PkgId) at .\loading.jl:858
 macro expansion at .\logging.jl:309 [inlined]
 require(::Module, ::Symbol) at .\loading.jl:840

I’ve also tried unsuccessfully Pkg.update() and removing the clones folder and rebuilding Makie, Statsmakie, AbstractPlotting and GLMakie all from master.

And I have opened an issue


#3

Thanks for trying it out!

GLMakie could definitely slim down a little bit, in particular I think it includes packages as dependencies that are only needed for the tests / doc generation. I’m also hoping for a GRMakie backend in the near future as GR proved to be one of the most reliable solutions.

Thanks for reporting! Hopefully these issues will get ironed out in the next few days and we could then tag a new release of GLMakie and stop asking users to be on master of a bunch of packages. This seems to be a dependency problem but if you have at least version 0.9.1 of AbstractPlotting I can’t understand how it is possible as AbstractBackend is defined there.


#4

Updates

  • The METADATA PR is now merged, so this should simplify the install a bit.

  • StatsMakie has now an experimental default Interact GUI on master, that can be called with:

using Interact, StatsMakie, Blink
ui = StatsMakie.gui(mydata)
w = Window()
body!(w, ui)

It is similar conceptually with what you’d get with DataVoyager but one plot at at a time:

Unfortunately having it as an Interact gui is detrimental to performance and interactivity (as Makie really shines as a native plotting package, even though a web based backend could be possible which would alleviate this issue), so there is ongoing work to add “backends” to Interact in such a way that one could turn an Interact GUI (potentially created with @manipulate) into a Makie GUI just by changing backend, but this is at a very early stage and could take a while.