Hi!
I spent some time in the net but a failed to find a suitable solution.
In the forum I found the helpful topic:
https://discourse.julialang.org/t/solved-plotting-2-plots-on-same-figure-with-dual-axis/124623
But the question is still not solved:
How to specify a legend if a figure contains two y-axis.
Example:
Given are: Xvec, VectorDistValues, VectorCurrent, VectorPrivious
fig = Figure()
ax1 = Axis(fig[1, 1], yticklabelcolor = :blue, xlabel = "n Iterations / -", ylabel = "Cycle Counter / -")
ax2 = Axis(fig[1, 1], yticklabelcolor = :red, yaxisposition = :right, ylabel = "Distance / -")
hln1 = lines!(ax1, Xvec, VectorDistValues, label= "Distance / -")
hln2 = lines!(ax2, Xvec, VectorCurrent, color = :red, label= "Current")
hln3 = lines!(ax2, Xvec, VectorPrivious, color = :orange, label= "Privious")
I know that the following works fine:
Legend(fig[1, 2],
[hln1, hln2, hln3],
["Distance / -", "Current", "Privious"],)
But I wonder if I can use the line-labels already specified in the line-definitions.
Something similar like the following (which works only for figures whith one y-axis):
Legend(fig[1, 2], ax1)
Any ideas?