Twinx() not keeping ticks in same position

Hi,

I’ve been trying to get a shared x-axis to work, but it seems like twinx() is not able to keep the x-ticks in the same position.

Here is an example:

using Random, Plots

Random.seed!(2018)
plot(randn(100), ylabel="y",label="y1111111111111", leg=:outertopright)
plot!(twinx(), randn(100)*10,
    c=:red,
    ylabel="y2",
    leg=:outerbottomright,
    size=(600, 400))

example

Sorry if I’m missing something obvious here.

Thanks for the help.

Probably [BUG] legend=:outertopleft misalgins x-axes of twinx · Issue #2894 · JuliaPlots/Plots.jl · GitHub.

1 Like

Note that there is a workaround this bug, using layouts, if needed.