How to layout figures in CairoMakie after they are generated

Note: Question on slack that I reposting here for wider audience.

Is there a way to layout figures in CairoMakie after they are generated? e.g. I have

julia> typeof(a1)

julia> typeof(a2)

I want to snap these together horizontally or vertically, basically layout Figure s
(I know I can do this while generating the actual figure, but curious if there was a layout option)

The answer below was posted by @sdanisch . this would be a useful feature in the ecosystem IMO.

“I made a little helper function for that some time ago”

function reparent(f::AbstractPlotting.FigurePosition, fig)
    ax = Axis(f.fig; fig.axis.attributes...)[] = ax
    for p in fig.axis.scene.plots
        plot!(ax, typeof(p), p.attributes, p.input_args...)
    return ax
f = Figure()
reparent(f[1, 1], fig)
reparent(f[1, 2], fig2)

Does that do what you want though? It seems an axis gets created and stuff replotted into it, but what about figures that have multiple axes, colorbars, etc? Also, a normal figure doesn’t even have an axis field, maybe this was meant for a FigureAxisPlot only