# How to properly set aspect for Axis defined in multiple fig positions in Makie

**URL:** <https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [October 16, 2025, 9:09pm UTC](https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216 "2025-10-16T21:09:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![albertomercurio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albertomercurio/32/27051_2.png) [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Post date:** [October 16, 2025, 9:09pm UTC](https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216/1 "2025-10-16T21:09:34Z")

</div>

Hello, I have the following figure structure

```julia-auto
fig = Figure()

ax1 = Axis(fig[1,1])
ax2 = Axis(fig[1,2])
ax3 = Axis(fig[2,1])
ax4 = Axis(fig[2,2])
ax5 = Axis(fig[1:2,3])

colsize!(fig.layout, 3, Relative(0.6))

fig

```

where I’m able to change the size of the third column.

However, I want now to the an equal aspect for `ax5`, which however takes multiple positions in the figure, so `colsize!(fig.layout, 3, Aspect(1:2, 1)` doesn’t work.

I would avoid to set the aspect using the `aspect` argument, as this doesn’t inform the figure layout to resize. Indeed, I want the axis to be exactly aligned to the figure layout.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 17, 2025, 9:39am UTC](https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216/2 "2025-10-17T09:39:33Z")

</div>

You can nest the left group so the big axis covers just one row:

```julia
fig = Figure(size = (700, 450))

gl = GridLayout(fig[1, 1])

ax1 = Axis(gl[1,1])
ax2 = Axis(gl[1,2])
ax3 = Axis(gl[2,1])
ax4 = Axis(gl[2,2])
ax5 = Axis(fig[1, 2])

poly!(ax5, Circle(Point2f(0, 0), 5))

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

fig

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/4/047478942941ab52996b6dbe69b176f771da63c5.png)

---

<div class="post-metadata">

**Author:** ![albertomercurio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albertomercurio/32/27051_2.png) [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Post date:** [October 18, 2025, 8:51am UTC](https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216/3 "2025-10-18T08:51:45Z")

</div>

Thanks. What if I can’t nest them because my layout is more complex?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 18, 2025, 5:56pm UTC](https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216/4 "2025-10-18T17:56:08Z")

</div>

What’s the actual layout then that you’re trying to create?

---

<div class="post-metadata">

**Author:** ![TimG](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TimG](https://discourse.julialang.org/u/TimG)\
**Post date:** [October 20, 2025, 11:02am UTC](https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216/5 "2025-10-20T11:02:19Z")

</div>

Presumably by (notionally) splitting the fig into ever-so-many cells, you can create any layout you want, even without nesting?

```julia-auto
fig = Mke.Figure()
    ax1 = Mke.Axis(fig[2:5, 2]
    ax2 = Mke.Axis(fig[2:5, 1]
    Mke.Legend(fig[6, 1]
    Mke.Label(fig[0, :]
    Mke.Label(fig[1, :]

```

(probably I have misunderstood what you say about the aspect!)

---

<div class="post-metadata">

**Author:** ![albertomercurio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albertomercurio/32/27051_2.png) [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Post date:** [October 22, 2025, 9:54pm UTC](https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216/6 "2025-10-22T21:54:52Z")

</div>

I have something like this

```julia-auto
fig_simple = Figure(size=(plot_figsize_width_pt, 0.5*plot_figsize_width_pt), figure_padding=1)

Label(fig_simple[1, 1:3], "Liouvillian", tellwidth=false, tellheight=true)
Label(fig_simple[1, 4:6], "Propagator", tellwidth=false, tellheight=true)

box_λ_simple = Box(fig_simple[2:5, 1:3], cornerradius = 5, color = (λ_color, 0.25), strokecolor = :transparent)
box_ϵ_simple = Box(fig_simple[2:5, 4:7], cornerradius = 5, color = (ϵ_color, 0.25), strokecolor = :transparent)

Makie.translate!(box_λ_simple.blockscene, 0, 0, -100)
Makie.translate!(box_ϵ_simple.blockscene, 0, 0, -100)

ax_λ_simple = Axis(fig_simple[3, 2])
ax_ϵ_simple = Axis(fig_simple[3, 5])
ax_λ_gap_simple = Axis(fig_simple[4, 2])
ax_ϵ_gap_simple = Axis(fig_simple[4, 5])
ax_ϵ_symmetry_simple = Axis(fig_simple[3:4, 6])

rowsize!(fig_simple.layout, 3, Aspect(5, 1))
rowsize!(fig_simple.layout, 2, 0)
rowsize!(fig_simple.layout, 5, 0)

colsize!(fig_simple.layout, 1, 0)
colsize!(fig_simple.layout, 3, 2)
colsize!(fig_simple.layout, 4, 2)
colsize!(fig_simple.layout, 7, 0)

rowgap!(fig_simple.layout, 8)
rowgap!(fig_simple.layout, 1, 2)
rowgap!(fig_simple.layout, 3, 10)
colgap!(fig_simple.layout, 8)
colgap!(fig_simple.layout, 3, 10)
colgap!(fig_simple.layout, 5, 10)

fig_simple

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 23, 2025, 8:00am UTC](https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216/7 "2025-10-23T08:00:06Z")

</div>

You nest only the axes whose rows don’t need to be aspect constrained, so that the big square one gets its own row:

```julia
plot_figsize_width_pt = 500
λ_color = :magenta
ϵ_color = :teal
fig_simple = Figure(size=(plot_figsize_width_pt, 0.5*plot_figsize_width_pt), figure_padding=1)

Label(fig_simple[1, 1:3], "Liouvillian", tellwidth=false, tellheight=true)
Label(fig_simple[1, 4:6], "Propagator", tellwidth=false, tellheight=true)

box_λ_simple = Box(fig_simple[2:4, 1:3], cornerradius = 5, color = (λ_color, 0.25), strokecolor = :transparent)
box_ϵ_simple = Box(fig_simple[2:4, 4:7], cornerradius = 5, color = (ϵ_color, 0.25), strokecolor = :transparent)

Makie.translate!(box_λ_simple.blockscene, 0, 0, -100)
Makie.translate!(box_ϵ_simple.blockscene, 0, 0, -100)

ax_λ_simple = Axis(fig_simple[3, 2][1, 1])
ax_ϵ_simple = Axis(fig_simple[3, 5][1, 1])
ax_λ_gap_simple = Axis(fig_simple[3, 2][2, 1])
ax_ϵ_gap_simple = Axis(fig_simple[3, 5][2, 1])
ax_ϵ_symmetry_simple = Axis(fig_simple[3, 6])

colsize!(fig_simple.layout, 6, Aspect(3, 1))
rowsize!(fig_simple.layout, 2, 0)
rowsize!(fig_simple.layout, 4, 0)

colsize!(fig_simple.layout, 1, 10)
colsize!(fig_simple.layout, 3, 10)
colsize!(fig_simple.layout, 4, 10)
colsize!(fig_simple.layout, 7, 10)

rowgap!(fig_simple.layout, 8)
rowgap!(fig_simple.layout, 1, 2)
rowgap!(fig_simple.layout, 3, 10)
colgap!(fig_simple.layout, 8)
colgap!(fig_simple.layout, 3, 10)
colgap!(fig_simple.layout, 5, 10)

fig_simple

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/e/5e62f52ce3ffab7d5acd4e6342e9e24ae0cbcb77.png)

---

<div class="post-metadata">

**Author:** ![albertomercurio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albertomercurio/32/27051_2.png) [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Post date:** [October 24, 2025, 1:38pm UTC](https://discourse.julialang.org/t/how-to-properly-set-aspect-for-axis-defined-in-multiple-fig-positions-in-makie/133216/8 "2025-10-24T13:38:33Z")

</div>

Thank you!
