Extract layout from a single leaf ggplot
Source:R/ggplot2_patchwork_utils.R
extract_leaf_plot_layout.RdMirrors the single-plot path in Ggplot2PlotOrchestrator: labels are
read from the BUILT plot first. ggplot2 v4 resolves derived labels only
while building – the stat-computed "count" of geom_bar(), and the
mapped column names – so an unbuilt labels holds nothing but the
explicit labs() overrides.