How to change the figure size of a seaborn axes or figure level plot
Modify Seaborn plot size using plt.figure(figsize=(width, height))
for axes-level plots and height
and aspect
parameters for figure-level plots.
Axes-level example with sns.barplot
:
Figure-level example with sns.catplot
:
Quick setup for A4-sized plots
Getting ready for print? Here's how you set up your Seaborn plots for A4 paper size:
Or before specific plots for clarity and control:
Customization using rcParams
Want to strut consistency over all your matplotlib plots? Befriend the rcParams
dictionary:
Persistently pleasing plots
Let's create a plot that fits perfectly to your ratio preferences:
Getting cold feet after creating the plot? No worries, you're in control:
Sizing figure-level plots
Dive deeper into Seaborn's figure-level functions like lmplot
, catplot
, and jointplot
;
But, if you seek absolute control over your plot sizes, let's turn to Matplotlib's methods:
Post-customization
After sizing, let's trim artwork for some visual polish.
All set? Save it for posterity:
Keeping your plot game strong
Here are some aspects to keep in mind for pristine plots:
Loading data
Load your dataset and then straight into Seaborn plots:
Mix it up with plot types
Unleash the power of various Seaborn plot types:
sns.violinplot()
for comparing distributions.sns.scatterplot()
for relationships revelation.sns.heatmap()
for those hot correlation matrices.
Join the plot discussion
Keep up-to-date with GitHub issues and StackOverflow discussions. They're treasure troves for tips, troubleshooting and memes.
Was this article helpful?