22  Makie

using WGLMakie

Basic plots using Makie.jl.

22.1 Boxplot

x = randn(300);
y = randn(400) .+ 1.6;
z = randn(320) .- 2.2;
key = vcat(repeat([1], 300), repeat([2], 400), repeat([3], 320));
boxplot(key, vcat(x, y, z))

22.2 Density

density(x)
dat=[x, y, z]
f = Figure()
ax = Axis(f[1, 1])
for (i, v) in enumerate(dat)
    density!(ax, v)
end
f

22.3 Histogram

hist(x)
f = Figure()
ax = Axis(f[1, 1])
for (i, vector) in enumerate(dat)
    hist!(ax, vector)
end
f

22.4 Scatter

x = randn(300);
y = 3 .+ x.^3 + randn(300);
y2 = 4 .+ x.^2 + randn(300);
scatter(x, y)
val = [y, y2]
f = Figure()
ax = Axis(f[1, 1])
for i in eachindex(val)
    scatter!(x, val[i])
end
f

22.5 Barplot

x = ["alpha", "beta", "gamma"];
y = [3, 9, 5];
y2 = [5, 8, 7];
barplot(collect(eachindex(x)), y, bar_labels=x)
val = hcat(y, y2);
xpos = reshape(collect(eachindex(val)), 2, 3);
f = Figure()
ax = Axis(f[1, 1])
for i in 1:size(val)[2]
    barplot!(xpos[i, :], val[:, i], bar_labels=x, width = 1)
end
f

23 Resources