If you don’t mind having the legend inside the first plot, you can do:
plot(layout=(2,5))
plot!(rand(32),subplot=1,label="blue")
plot!(rand(32),subplot=1,label="orange")
for sp in 2:10
plot!(rand(32),subplot=sp,label="")
end
plot!()
If you do mind, there are sophisticated plot layouts that can be obtained using Makie.jl
I usually end up building subplots from individual plots because I find that various settings differ by subplot (e.g., only showing x axis labels on the plots in the bottom row; only showing y axis labels for the left most column).
So I do:
pV = Vector{Any}(undef, n);
for j = 1 : n
# can customize axis labels etc here
pV[j] = plot(<data>, labels = ["blue" "red'], legend = (j == 1));
end
p = plot(pV..., layout = (2,5));
Those are useful. I’ve end up doing something similar. However, it’s not quite what I was looking for. I wanted one common legend, to be placed for example outside the plot region, common for all subplots. That seems not to be possible.