Shared axes (twin)
using Plots
pgfplotsx()
twinx
(shared x
axis) and twiny
(shared y
axis) example usage.
kw = (; lab = "", title_loc = :left)
x = π:0.1:2π
plot(x, sin.(x), xaxis = "common X label", yaxis = "Y label 1", color = :red, title = "twinx"; kw...)
pl = plot!(twinx(), x, 2 * cos.(x), yaxis = "Y label 2"; kw...)
plot(x, cos.(x), xaxis = "X label 1", yaxis = "common Y label", color = :red, title = "twiny"; kw...)
pr = plot!(twiny(), 2x, cos.(2x), xaxis = "X label 2"; kw...)
plot(pl, pr)
This page was generated using DemoCards.jl and Literate.jl.