Makie: Unwanted whitespace to right of 3D subplots, and don't fully understand behaviour of colgap! with 3D plots

I have a small issue where there is some unwanted whitespace on the right of my figure. Also, the behaviour of colgap is a bit weird to me with 3D plots.

The code I am using just makes four 2d plots and four 3d plots in a grid 2*8 grid:

using CairoMakie

function plot2d(f)
    x,y = rand(100), rand(100)
    ax = Axis(f[1,1])
    hidedecorations!(ax)
    scatter!(ax,x,y)
end

function plot3d(f)
    x,y,z = rand(100), rand(100), 100 .*rand(100)
    ax = Axis3(f[1,1])
    hidedecorations!(ax)
    scatter!(ax,x,y,z)
end

f = Figure(size = (500,300),fontsize=10,pt_per_unit=1)

for i in 1:2, j in 1:2
    plot2d(f[i,2*j-1])
    plot3d(f[i,2*j])
end

rowgap!(f.layout,0)
colgap!(f.layout,0)

f

The above code produces a figure with more whitespace on the right than the left, and the gap between rowws and columns is not zero. Is there a way to remedy both of these facts?
image

With 2D plots, the plots have exactly zero gap as expected and the whole figure is symmetric:
image

I can get the plots closer together using negative col/row gaps, but it’s a bit of guesswork on how negative they need to be. Am I missing some property somewhere that will help with this?

Yes, protrusions https://docs.makie.org/stable/reference/blocks/axis3/#protrusions

So the reason is that Axis sets its protrusions (stuff outside the alignment area) automatically, because that’s generally possible in 2d without cyclical behavior (with certain exceptions). But Axis3 doesn’t because those values would change all the time when the space available for Axis3 changes, and so the projection changes, and so the tick positions change.

Long story short, that’s why the protrusion values are currently hardcoded and you need to set them yourself if you want different ones. There are currently no helpers for doing that, I’ve been thinking about writing some but didn’t have time (like functions that determine how far the tick labels currently stick out).

Great thank you! This is very useful. This also helps a lot with the bug I was having in my other post, as I can now shrink the GLMakie window without the protrusions pushing 3D axes into zero space.