Question: Why do I keep getting this warning whenever I try to use FacetGrid from seaborn? UserWarning: The figure layout has changed to tight. self._figure.tight_layout(*args, **kwargs) I understand it's a warning and not an error and I also understand it is changing the layout to tight. My question is why does it appear in the first place? Am I missing something? Example code: import seaborn as sns penguins = sns.load_dataset("penguins") g = sns.FacetGrid(penguins, col="island") g.map_dataframe(sns.histplot, x="bill_length_mm")  This code throws that warning. What am I doing wrong? I know I can hide them with warnings module but I don't wanna do that.

Answer: As mentioned in the comments, this is a matplotlib bug. It was fixed in version 3.7.3, so you can avoid it by upgrading Matplotlib. One of the comments suggests calling plt.figure(..., layout='constrained'), instead of tight_layout(), and that matches a few comments I found in the docs, like the Constrained Layout Guide:  Constrained layout is similar to Tight layout, but is substantially more flexible.  I saw this warning, because I was calling subplots(), then repeatedly plotting, calling tight_layout(), saving the figure, and calling cla(). I fixed it by removing the call to tight_layout() from the loop, and calling subplots(..., layout='tight').  Mind that you may need Python 3.11 for matplotlib 3.7.3, as a test with Python 3.10 shows: conda install matplotlib[version='>=3.7.3']  Output: Retrieving notices: ...working... done Channels: - defaults Platform: linux-64 Collecting package metadata (repodata.json): done Solving environment: \ warning libmamba Added empty dependency for problem type SOLVER_RULE_UPDATE failed LibMambaUnsatisfiableError: Encountered problems while solving: - package matplotlib-3.8.0-py311h06a4308_0 requires matplotlib-base >=3.8.0,<3.8.1.0a0, but none of the providers can be installed Could not solve for environment specs The following packages are incompatible ├─ matplotlib-base 3.7.2.* is installable with the potential options │ ├─ matplotlib-base 3.7.2, which can be installed; │ ├─ matplotlib-base [3.7.2|3.8.0] would require │ │ └─ python >=3.10,<3.11.0a0 , which can be installed; │ ├─ matplotlib-base 3.7.2 would require │ │ └─ python >=3.8,<3.9.0a0 , which can be installed; │ └─ matplotlib-base [3.7.2|3.8.0] would require │ └─ python >=3.9,<3.10.0a0 , which can be installed; ├─ matplotlib >=3.7.3 is installable with the potential options │ ├─ matplotlib 3.8.0 would require │ │ └─ matplotlib-base >=3.8.0,<3.8.1.0a0 with the potential options │ │ ├─ matplotlib-base [3.7.2|3.8.0], which can be installed (as previously explained); │ │ ├─ matplotlib-base [3.7.2|3.8.0], which can be installed (as previously explained); │ │ ├─ matplotlib-base 3.8.0 conflicts with any installable versions previously reported; │ │ └─ matplotlib-base 3.8.0 would require │ │ └─ python >=3.12,<3.13.0a0 , which can be installed; │ ├─ matplotlib 3.8.0 would require │ │ └─ python >=3.10,<3.11.0a0 , which can be installed; │ ├─ matplotlib 3.8.0 would require │ │ └─ python >=3.12,<3.13.0a0 , which can be installed; │ └─ matplotlib 3.8.0 would require │ └─ python >=3.9,<3.10.0a0 , which can be installed; └─ pin-1 is not installable because it requires └─ python 3.11.* , which conflicts with any installable versions previously reported. Pins seem to be involved in the conflict. Currently pinned specs: - python 3.11.* (labeled as 'pin-1')