tight_layout may not adjust correctly without a renderer in matplotlib figure layout
0 reputation · 24 Oct 2021, 03:03 UTC
When a matplotlib Figure is created and tight_layout() is called before any rendering step, the layout adjustments may not be applied correctly, especially on non-interactive backends such as Agg where no renderer exists prior to drawing.
If constrained_layout is then enabled—either via subplots(constrained_layout=True) or Figure.set_constrained_layout(True)—the figure may retain stale tight_layout settings or produce overlapping and clipped labels because constrained_layout evaluates at draw time while tight_layout runs only once.
Does constrained_layout ignore tight_layout adjustments when no renderer has been created? Does this conflict cause label overlap or clipping in saved figures versus on-screen display? What is the difference in behavior across Matplotlib 3.x releases?