Hidedecorations not working as expected for PolarAxis?

I’m putting together a fairly complicated figure, involving a mixture of line plots and polar histogram plots. Using PolarAxis for the latter, I found that they appear to take up more space than needed. To illustrate the problem, I put together a simple example:

function polar_test()
   θ = range(-π, stop=π, length=100)
    r = 0.1 .+ rand(100)
    fig = Figure()
    lg1 = GridLayout(fig[1,1])
    ax1 = PolarAxis(lg1[1,1])
    scatter!(ax1, θ, r)
    Makie.Box(lg1[1,1],color = (:red, 0.0), strokewidth = 1)
    ax2 = Axis(lg1[1,2])
    scatter!(ax2, θ, r)
    Makie.Box(lg1[1,2],color = (:red, 0.0), strokewidth = 1)
    lg2 = GridLayout(fig[2,1])
    ax3 = PolarAxis(lg2[1,1], alignmode=Inside())
    hidedecorations!(ax3)
    scatter!(ax3, θ, r)
    Makie.Box(lg2[1,1],color = (:red, 0.0), strokewidth = 1)
    ax4 = Axis(lg2[1,2])
    Makie.Box(lg2[1,2],color = (:red, 0.0), strokewidth = 1)
    scatter!(ax4, θ, r)
    hidedecorations!(ax4)
    fig
end

polar_test()

For the normal Axis object (right column) hiding the decorations allocates more space for the plot in the grid layout, but for the PolarAxis (left column), the axis takes up the same amount of space. Is this a bug, or was it intended? Is there a quick fix to force the axis to take up the full space allotted to it by the layouting algorithm?

Hmm, it seems like the ticks are not integrated into protrusions in PolarAxis, so this might be an issue.

The quick fix is to set polar_axis.thetaticklabelsize and polar_axis.rticklabelsize to 0. That should get you most of the way there.

So the alignmode etc can’t actually help, since they don’t know about the ticks.

Here’s an MWE stepping through what I did:

θ = range(-π, stop=π, length=100)
r = 0.1 .+ rand(100)

f, a, p = lines(r, θ; axis = (; type = PolarAxis))
b = Box(f[1, 1]; color = (:red, 0.3))
translate!(b, 0, 0, 10000) # get the box on top of the polar axis
f

hidedecorations!(a)

(this is still bad)

a.thetaticklabelsize[] = 0
a.rticklabelsize[] = 0


It’s still not 100% tight, but at least mostly there. It would be great if you could open an issue on the Makie repo with this info!