How to combine the legend of multiple axes on same figure into one in Makie.jl?

@jules Thanks a lot! It worked with the code you mentioned. For anyone else wondering this is how:

plots_in_fig = AbstractPlot[]
labels_in_fig = AbstractString[]
for ax in axes
    pl, lb = Makie.get_labeled_plots(ax, merge=false, unique=false)
    append!(plots_in_fig, pl)
    append!(labels_in_fig, lb)
end

ulabels = Base.unique(labels_in_fig)
mergedplots = [[lp for (i, lp) in enumerate(plots_in_fig) if labels_in_fig[i] == ul]
        for ul in ulabels]

Legend(fig[:, 2], mergedplots, ulabels)
1 Like