Hi, guys
I am trying to replicate the following code from the book Julia Data Science.
I got a problem when I wanted to add a legend for the chart of the series()
part, and put it below the chart horizontally, not in the chart, which is the original code does using axislegend()
.
I guess the problem is caused by the labels produced by series()
. Please help me out. Thanks!
Random.seed!(123)
y = cumsum(randn(6, 6), dims = 2)
Random.seed!(13)
matrix = randn(20, 20)
xv = yv = LinRange(-3, 0.5, 20)
function demo_themes(y, xv, yv, matrix)
fig, ax, plt = series(y;
labels = ["$i" for i in 1:6],
markersize = 10,
colormap = :Set1,
figure = (;
resolution = (600, 500)),
axis = (;
xlabel = "time (s)",
ylabel = "Amplitude",
title = "My Testing of Makie",
titlesize = 30,
xticklabelsize = 14,
yticklabelsize = 14)
)
hmap = heatmap!(xv, yv, matrix;
colormap = :Spectral_5)
limits!(-3.1, 7.5, -6, 5.1)
# Here I want to put some legend
# such as
# Legend(fig[2,1], ax, or something), but it does not work
Colorbar(fig[1, 2], hmap)
fig
end
demo_themes(y, xv, yv, matrix)