3 yaxes with Makie?

Is it possible to make 3 or more y-axes with Makie.jl? You can plot the data but how to move the spines?

fig=Figure()
ax11 = Axis(fig[1,1], ylabel="Series 1")
lines!(cumsum(randn(1000)))
ax12 = Axis(fig[1,1], yticklabelpad=100, ylabel="Series 2")
lines!(cumsum(randn(1000)) .* 10, color=Cycled(2))
ax13 = Axis(fig[1,1], yticklabelpad=200, ylabel="Series 3")
lines!(cumsum(randn(1000)) .* 100, color=Cycled(3))
fig

I came up with this hack

fig=Figure()
ax11 = Axis(fig[1,3], ylabel="Series 1")
lines!(cumsum(randn(1000)), color=:grey)
ax12 = Axis(fig[1,3], ylabel="Series 2")
lines!(cumsum(randn(1000)) .* 10, color=:dodgerblue)
ax13 = Axis(fig[1,3], ylabel="Series 3")
lines!(cumsum(randn(1000)) .* 100, color=:orange)

linkxaxes!(ax11, ax12, ax13)
hidespines!(ax12, :r, :l, :b, :t)
hidespines!(ax13, :r, :l, :b, :t)

hidespines!(ax12, :r, :l, :b, :t)
hidespines!(ax13, :r, :l, :b, :t)
hidedecorations!(ax12)
hidedecorations!(ax13)

ax12_2 = Axis(fig[1,2], ylabel="Series 2",
    yticklabelcolor = :dodgerblue,
    leftspinecolor = :dodgerblue,
    ytickcolor = :dodgerblue,
    ylabelcolor = :dodgerblue,
)
ax13_2 = Axis(fig[1,1],ylabel="Series 3",
    yticklabelcolor = :orange,
    leftspinecolor = :orange,
    ytickcolor = :orange,
    ylabelcolor = :orange,
)

linkyaxes!(ax12, ax12_2)
hidexdecorations!(ax12_2)
hideydecorations!(ax12_2, label=false, ticklabels=false, ticks=false)
hidespines!(ax12_2, :r, :b, :t)

linkyaxes!(ax13, ax13_2)
hidexdecorations!(ax13_2)
hideydecorations!(ax13_2, label=false, ticklabels=false, ticks=false)
hidespines!(ax13_2, :r, :b, :t)

colsize!(fig.layout, 1, 20)
colsize!(fig.layout, 2, 20)

fig

2 Likes