Having legend on top of twinx() line

Hi there, I am plotting 4 different sine waves. The scale of one of these waves is on a seperate y axis. Using the code below, I have obtained the following graph:

plot(sol_2_elem, idxs = wk2model.source.Δp, labels="2 Element WK", ylabel="Pressure", xlims=(7.0,10.0))
plot!(sol_3_elem, idxs = wk3model.source.Δp, labels="3 Element WK", xlims=(7.0,10.0))
plot!(sol_4_elem, idxs = wk4model.source.Δp, labels="4 Element WK", xlims=(7.0,10.0))
plot!(twinx(), t1, i, c=:gray, ls=:dash, xlims=(7.0,10.0), label="")
plot!((0, NaN), c=:gray, ls=:dash, label="Blood Flow (ml/s)")


Is there a way of having the legend on top of the dashed gray line whose scale is on the second y axis? I tried moving the legend outside of the graph using legend = :outertopleft, but that resulted in the following graph, I’m not sure why the gray line didn’t follow the same format.


Thank you!

[BUG] legend=:outertopleft misalgins x-axes of twinx · Issue #2894 · JuliaPlots/Plots.jl (github.com)

the easiest thing to do might be to increase the ylims:

plot!(legend=:topright, ylims=(-10, 300))