How to change the figure size of a seaborn axes or figure level plot
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Changing figure size in Seaborn depends on what kind of function you are using. Axes-level plots borrow an existing Matplotlib figure or axes, while figure-level plots create their own figure internally and use parameters such as height and aspect instead of figsize.
Axes-Level Plots Use Matplotlib Figure Size
Functions such as sns.lineplot, sns.scatterplot, sns.barplot, and sns.histplot are axes-level. That means you control their size through Matplotlib before drawing the plot.
The key is figsize=(8, 4), which sets width and height in inches.
You can also use plt.figure(figsize=(8, 4)), but plt.subplots() is cleaner when you want direct access to the axes object.
Figure-Level Plots Use height and aspect
Functions such as sns.relplot, sns.catplot, sns.displot, sns.lmplot, and sns.pairplot are figure-level. They build a FacetGrid-style object internally, so the primary sizing controls are different.
For relplot, catplot, and similar functions, the official Seaborn API uses:
- '
height, which is the height of each facet in inches' - '
aspect, which is the width-to-height ratio of each facet'
If height=4 and aspect=1.4, each subplot is 5.6 inches wide and 4 inches tall.
Resizing After the Plot Is Created
You can still resize many Seaborn plots after creation by reaching into the underlying Matplotlib figure.
For an axes-level plot:
For a figure-level plot:
This is handy when you need to tune layout after seeing labels, titles, or legends.
Global Defaults
If you want a consistent size for many axes-level plots, you can set a global Matplotlib default through Seaborn's theme configuration:
This affects plots that rely on Matplotlib's default figure creation. It is most useful for quick scripts and notebooks, not for situations where each chart should be explicitly sized.
Special Note for pairplot
pairplot is figure-level, but its sizing works slightly differently. It uses height for each subplot cell and derives the total figure size from the grid dimensions.
When the number of variables grows, the total figure can become large quickly because the size is repeated across many grid cells.
Choosing the Right Sizing Strategy
Use figsize when:
- you are calling an axes-level function
- you already have a Matplotlib figure or subplot layout
- you want exact total figure dimensions
Use height and aspect when:
- you are calling a figure-level Seaborn function
- the plot creates its own figure
- you are working with faceting and want each panel sized consistently
Once you know which category the function belongs to, the sizing API becomes predictable.
Common Pitfalls
The most common mistake is passing figsize directly into a figure-level function such as relplot. Those functions do not use that argument the way axes-level functions do.
Another pitfall is forgetting that figure-level sizing applies per facet, not always to the whole final canvas. A faceted grid with several columns can end up much wider than expected.
A third pitfall is mixing plt.figure(figsize=...) with a figure-level function and assuming the earlier Matplotlib call will control the result. Figure-level Seaborn functions create their own figure, so the external figsize often has no effect.
Finally, legends and long labels can make a correctly sized figure still look crowded. Sometimes the fix is not only size, but also layout, rotation, or faceting choices.
Summary
- Axes-level Seaborn plots use Matplotlib sizing through
figsize - Figure-level Seaborn plots use
heightandaspect - You can also resize afterward with
set_size_inches - '
pairplotand faceted plots size each panel rather than only the final canvas' - The right sizing method depends on whether the Seaborn function is axes-level or figure-level

