Remove whitespace between Axis3 and Label

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?

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

Yes, here it be, and thanks:

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

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:

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

2 Likes

Perfect, thank you.