I have a dataset where each column is a list of occurrences. I would like to plot three columns as three histograms within one figure, but I cannot wrap my head around the AlgebraOfGraphics idioms.
Within Makie.jl, I would do
fig = Figure()
ax = Axis(fig[1,1])
hist!(ax, df[:pf], label = "Plasma frame")
hist!(ax, df[:sf], label = "Shock frame")
hist!(ax, df[:ISM], label = "ISM frame")
axislegend(ax)
fig
where df
is my data source and each of df[:pf]
, df[:sf]
, and df[:ISM]
is a Vector
.
With AlgebraOfGraphics.jl, I’ve tried
using AlgebraOfGraphics
import AlgebraOfGraphics as AoG
data = AoG.data(df)
m = AoG.mapping(:pf => "Plasma frame") +
AoG.mapping(:sf => "Shock frame") +
AoG.mapping(:ISM => "ISM frame")
hist_layer = AoG.histogram()
layer = data * m * hist_layer
The issue I’m having is with labeling each histogram. I know the =>
Pair syntax labels the axes, but I couldn’t figure out how to add data series labels from the AoG documentation.