Issue with 2 y axis using twinx with subplots using Plots.jl

Everything is possible:

using Measures, Plots; gr()

x = 0:0.1:1
l = @layout [a b]
p1 = plot(x, cos.(x), lc=:red, legend=:topleft, label="1",right_margin=5mm, ylims=(0.5, 1.1))
plot!(twinx(), x, sin.(x), ylims=(0.0, 1.0), lc=:blue, label=false)
plot!([-1],[0], xlims=extrema(x), lc=:blue, label="2")
p2 = plot(x, tan.(x), label="3", ylims=(0.0, 1.8))
plt = plot(p1, p2, layout = l)
2 Likes