Plots.jl icon indicating copy to clipboard operation
Plots.jl copied to clipboard

[BUG] Cannot Independently Set ylims for twined (`twinx()`) axes

Open nickbrady opened this issue 1 year ago • 0 comments

Perhaps related to another issue with twinx(): it is not possible (or does not seem possible) to independently set the y-limits of the twined axes.

MWE

using Plots

x1 = collect(0:10)

y1 = randn(length(x1))
y2 = ones(length(x1))

p = plot(x1, y1, color=:red)
p_twin = twinx(p)

p_twin = plot!(p_twin, x1, y2, color=:blue)
ylims!(p, -2, 2)
ylims!(p_twin, 0, 2)

Versions

Julia version 1.10 Plots.jl version 1.40

nickbrady avatar Jan 25 '24 00:01 nickbrady