Hello,
I have a plot with many lines, and a legend with labels for all those lines. Here is an example output.
using CairoMakie
set_theme!(theme_latexfonts())
update_theme!(
palette=(color=ColorSchemes.glasbey_category10_n256.colors,),
ScatterLines=(cycle=Cycle(:color),)
)
function main()
f = Figure()
ax = Axis(f[1, 1])
for i in 1:30
lines!(ax, 0:127, rand(128), label=string(i))
end
Legend(f[1, 2], ax, "Some Title", framevisible=false)
ax.xlabel = "x-axis"
ax.ylabel = "y-axis"
resize_to_layout!(f)
save("mwe.png", f)
end
main()
I have tried the resize_to_layout!()
and unfortunately it does not work, In python I could add the legend as an artist and the final output would automatically resize itself to fit in the whole legend. Is there a similar way to do it in Makie?