I've got a working notebook that produces a nice tight multi-panel plot of with tight_layout():
Screen-Shot-2022-02-03-at-10.00.58-AM.png
I'm using the exact same code to examine a different model variable. The xarray DataArrays I'm plotting (correlation scores) have exactly the same dimensions, coordinates, and attributes (none) as in the working example. I'm using the same python environment, etc. Something trips up matplotlib tight_layout() in the second example, and I get the following plot that has lots of undesirable white space:
Screen-Shot-2022-02-03-at-10.05.50-AM.png
I've done a search on google, stackoverflow, etc for information about the error ("Tight layout not applied. tight_layout cannot make axes width small enough to accommodate all axes decorations") but to no avail. Has anyone seen similar behavior and have an idea of what could be triggering the matplotlib layout error?
Last updated: May 16 2025 at 17:14 UTC