Graphical Exploratory Data Analysis in Julia with VegaLite/Gadfly/Plots

I think the best solution would be if vega-lite (the JavaScript library) added macros for histograms and densities, like they did for other common things previously. If we had that, then the existing Julia wrapper would allow us to just write your example as:

@vlplot(x=:height, background=:grey, title="Bla Bla") +
  @vlplot({:histogram, color=:lightblue}) +
  @vlplot({:density, color=:green, opacity=0.25})

Or something similar to that. I feel that is similarly concise to your suggestion? The big benefit would be that it wouldn’t require any additional “ideas” on the Julia side of things. The logic here would be that the first @vlplot call defines properties for the whole plot, and the next two @vlplot calls each become one layer in a layered plot.

Having said that, I’ve also started a new higher level Julia package, like what you suggested, see here for a discussion, and the package is QuickVega.jl (but be warned, the package is empty at this point). But there is a crucial difference to your suggestion: in my mind QuickVega.jl will not have a grammar of graphics style API, instead it will just be a “one function → one figure” type API. But it will be possible to combine the plots that you get via that route with “normal” VegaLite.jl plots via composition.

1 Like