Multiple Seaborn FacetGrid plots on a single PDF page

Viewed 20

I would like to create a multi-page PDF in which each page has multiple independent seaborn FacetGrid plots. I have been able to do this using the new seaborn.objects interface that comes with 0.12.0, see the example here. However, I would like to use the sns.relplot function to draw the charts.

Example code below, all the FacetGrid objects here are identical in the example, but in practice they would be leveraging different data that cannot be combined into a single larger FacetGrid.

import seaborn as sns
penguins = sns.load_dataset("penguins")

# Want g1 and g2 stacked vertically on first PDF page
g1 = sns.relplot(data=penguins, x='bill_length_mm', y='bill_depth_mm', col='species')
g2 = sns.relplot(data=penguins, x='bill_length_mm', y='bill_depth_mm', col='species')

# Want g3 and g4 stacked vertically on second PDF page
g3 = sns.relplot(data=penguins, x='bill_length_mm', y='bill_depth_mm', col='species')
g4 = sns.relplot(data=penguins, x='bill_length_mm', y='bill_depth_mm', col='species')
0 Answers
Related