# Remove whitespace between Axis3 and Label

**URL:** https://discourse.julialang.org/t/remove-whitespace-between-axis3-and-label/105461
**Category:** Visualization
**Tags:** makielayout
**Created:** [October 27, 2023, 3:17am UTC](https://discourse.julialang.org/t/remove-whitespace-between-axis3-and-label/105461 "2023-10-27T03:17:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![AshtonSBradley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashtonsbradley/32/11140_2.png) [@AshtonSBradley](https://discourse.julialang.org/u/AshtonSBradley)
#### Post date: [October 27, 2023, 3:17am UTC](https://discourse.julialang.org/t/remove-whitespace-between-axis3-and-label/105461/1 "2023-10-27T03:17:08Z")

</div>

I want to get my label closer to the axis. I have tried every combination of Axis3 and label options I can think of, and resizing the figure, but I haven’t improved on this. Is there a version of rowgap that could be used for Label?

 ![Screenshot 2023-10-27 at 4.13.19 PM](https://global.discourse-cdn.com/julialang/original/3X/d/e/de9456c3f9835a14733bcf6019b1ebdc24b50a7e.png)

---

<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 27, 2023, 4:25am UTC](https://discourse.julialang.org/t/remove-whitespace-between-axis3-and-label/105461/2 "2023-10-27T04:25:48Z")

</div>

Could you post the bare scaffolding code without data, so I can check which settings Axis3 uses and how that affects the spacing?

---

<div class="post-metadata">

### Author: ![AshtonSBradley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashtonsbradley/32/11140_2.png) [@AshtonSBradley](https://discourse.julialang.org/u/AshtonSBradley)
#### Post date: [October 27, 2023, 5:40am UTC](https://discourse.julialang.org/t/remove-whitespace-between-axis3-and-label/105461/3 "2023-10-27T05:40:05Z")

</div>

Yes, here it be, and thanks:

```julia
using CairoMakie 

f = Figure(resolution = (600,800))

# axes
dens = f[1,1] = GridLayout()
pot = f[2,1] = GridLayout()

ax=Axis3(dens[1,1],elevation=pi/7,perspectiveness=.6,zgridvisible=false,xgridvisible=false,ygridvisible=false)
Label(dens[1,1,TopLeft()],"(a)",halign=:right)
f

axp = Axis(pot[1,1], aspect = 1)
Label(pot[1,1,TopLeft()],"(b)",halign=:left)
f

axc = Axis(pot[1,2])
Label(pot[1,2,TopLeft()],"(c)",halign=:left)

rowsize!(f.layout,2,Relative(.3))
rowsize!(pot,1,Relative(.6))
rowgap!(f.layout,1,0)
f

```

 ![Screenshot 2023-10-27 at 6.46.49 PM](https://global.discourse-cdn.com/julialang/original/3X/7/0/706591308e87c34670e78aebcae25d7a0e788618.png)

---

<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 27, 2023, 7:41am UTC](https://discourse.julialang.org/t/remove-whitespace-between-axis3-and-label/105461/4 "2023-10-27T07:41:15Z")

</div>

Ok this has to do with the `perspectiveness` setting, even with `viewmode = :stretch` the axis doesn’t fill the whole space corner to corner. So maybe that calculation can be improved. You could set `perspectiveness = 0` although aesthetically that might not be what you wanted.

One hack you can do now, is to give the Axis3 a negative margin at the top via the `alignmode`, that pulls the upper border upwards:

```julia
f = Figure(resolution = (600,800))

# axes
dens = f[1,1] = GridLayout()
pot = f[2,1] = GridLayout()

ax=Axis3(dens[1,1],elevation=pi/7,perspectiveness=.6,zgridvisible=false,xgridvisible=false,ygridvisible=false,
    alignmode = Mixed(top = -150))
Label(dens[1,1,TopLeft()],"(a)",halign=:right)
f

axp = Axis(pot[1,1], aspect = 1)
Label(pot[1,1,TopLeft()],"(b)",halign=:left)
f

axc = Axis(pot[1,2])
Label(pot[1,2,TopLeft()],"(c)",halign=:left)

rowsize!(f.layout,2,Relative(.3))
rowsize!(pot,1,Relative(.6))
rowgap!(f.layout,1,0)
f

```

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

---

<div class="post-metadata">

### Author: ![AshtonSBradley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashtonsbradley/32/11140_2.png) [@AshtonSBradley](https://discourse.julialang.org/u/AshtonSBradley)
#### Post date: [October 27, 2023, 8:19am UTC](https://discourse.julialang.org/t/remove-whitespace-between-axis3-and-label/105461/5 "2023-10-27T08:19:28Z")

</div>

Perfect, thank you.
