Hello,
I want to create a figure using Makie.jl that aligns different axes in different layouts. For example, I have the following code
using CairoMakie
CairoMakie.activate!(type = "svg", pt_per_unit = 1.25)
λ_color = :dodgerblue3
ϵ_color = :crimson
fig = Figure(size=(430, 0.85*430))
Label(fig[1, 1], "Liouvillian", tellwidth=false, tellheight=true)
Label(fig[1, 2], "Propagator", tellwidth=false, tellheight=true)
grid_λ = GridLayout(fig[2, 1], alignmode=Outside(15))
grid_ϵ = GridLayout(fig[2, 2], alignmode=Outside(15))
box_λ = Box(fig[2, 1], cornerradius = 10, color = (λ_color, 0.25), strokecolor = :transparent)
box_ϵ = Box(fig[2, 2], cornerradius = 10, color = (ϵ_color, 0.25), strokecolor = :transparent)
# move the boxes back so the Axis background polys are in front of them
Makie.translate!(box_λ.blockscene, 0, 0, -100)
Makie.translate!(box_ϵ.blockscene, 0, 0, -100)
ax_λ = Axis(grid_λ[1, 1], ylabel=L"\mathrm{Im}(\lambda)")
ax_ϵ = Axis(grid_ϵ[1, 1], ylabel=L"\mathrm{Im}(\epsilon)")
ax_λ_gap = Axis(grid_λ[2, 1], xlabel=L"\mathrm{Re}(\lambda)", ylabel=L"\mathrm{Im}(\lambda)")
ax_ϵ_gap = Axis(grid_ϵ[2, 1], xlabel=L"\mathrm{Re}(\epsilon)", ylabel=L"\mathrm{Im}(\epsilon)")
# --- Limits and aspect ratios ---
ylims!(ax_λ_gap, -100, 100)
xlims!(ax_ϵ_gap, 0.88, 1.01)
ylims!(ax_ϵ_gap, -0.25, 0.25)
rowsize!(grid_λ, 1, Aspect(1, 1))
rowsize!(grid_λ, 2, Aspect(1, 1))
rowsize!(grid_ϵ, 1, Aspect(1, 1))
rowsize!(grid_ϵ, 2, Aspect(1, 1))
rowgap!(grid_λ, 8)
rowgap!(grid_ϵ, 8)
rowgap!(fig.layout, 2)
colgap!(fig.layout, 5)
# save(joinpath(@__DIR__, "figures/eigenvalues_sketch.pdf"), fig, pt_per_unit = 1)
fig
That generates the following image
However, the axes in the different columns are not exactly aligned. This can be seen by changing the labels in the various plots.
I was thinking to remove the grid layout implementation, and just use the figure internal layout, but I didn’t manage to do it.