AlgebraOfGraphics documentation frustrations

Eben60
Sat, 15 Nov 2025 19:13:47 +0000
General Usage

After undertaking one more attempt to wrap my head around AlgebraOfGraphics I started to suspect the problem is not only me being stupid, lazy, and unable to abstract logical thinking.

Ok, please help me to make some simple plots. First let’s produce some sample data

using AlgebraOfGraphics, DataFrames

# sample data
function make_y(v, n)
    m = Matrix{Float64}(undef, length(v), n)
    for i in 1:n
        e = 0.4 + i * 0.1
        m[:, i] = v .^ e
    end
    return m
end

xs = 0.0:10
m = hcat(xs, make_y(xs, 5))
nms = vcat("x", ["y$n" for n in 1:5])
df = DataFrame(m, nms)

I’d like to have

Lines of the same color

Lines differentiated in color using default palette

Lines differentiated in color using given palette from ColorSchemes.jl (if supported)

Lines differentiated in style

Scatter differentiated in color

Scatter differentiated marker form

OK, the first is easy and kind of logical:

plt = data(df) * mapping(:x, names(df)[2:end] .=> :y) * visual(Lines) |> draw

47 posts - 17 participants