Description
Currently FacetGrid
and its consumers relplot
and catplot
will always create a new figure when you call them. In my workflow, I often like to create the figures or axes beforehand and then pass these as arguments to seaborn functions. This works with axes level plots line lineplot
and scatterplot
, where you can pass the ax
parameter, and if you don't it uses plt.gca()
.
I would like to propose that FacetGrid
should take a parameter fig=None
, and if specified it uses it, otherwise it uses the existing code as such:
if fig is None:
with mpl.rc_context({"figure.autolayout": False}):
fig = plt.figure(figsize=figsize)
That would allow me to force specific plots to be associated with specific figure numbers, which helps me keep track of things as I work. I can make this PR if there is interest in this feature. I made a draft here: #2831 and I will work on the remaining bullet points if there is interest.