[CairoMakie] Mirrored axis sharing

Hello, :smiley:
Is it possible to do a “Mirrored axis sharing” in CairoMakie, like on this image for example?

(from Axes review · Issue #206 · MakieOrg/Makie.jl (github.com)

Thank you !
fdekerm

You could do something like this:

f = Figure()
ax1 = Axis(f[1, 1], xreversed = true, xautolimitmargin = (0, 0.1))
ax2 = Axis(f[1, 2], alignmode = Mixed(left = Makie.Protrusion(0)), xautolimitmargin = (0, 0.1))
hideydecorations!(ax1, grid = false)
linkyaxes!(ax1, ax2)
colgap!(f.layout, 0)

hist!(ax1, randn(1000) .* 20, direction = :x, color = :pink, bins = -50:5:50)
hist!(ax2, randn(1000) .* 20, direction = :x, color = :slateblue2, bins = -50:5:50)

ax1.yticks = -50:5:50
ax2.yticks = -50:5:50

f

2 Likes