- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to adjust the space between Matplotlib/Seaborn subplots for multi-plot layouts?
To adjust the space between matplotlib/seaborn subplots for multi-plot layouts, we can take the following steps
Steps
Set the figure size and adjust the padding between and around the subplots.
Create a figure and a set of subplots.
Adjust the subplot layout parameters.
Create Seaborn's box plot for all the subplots.
To display the figure, use Show() method.
Example
import seaborn as sns from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True fig, axes = plt.subplots(2, 2) # Adjust the subplot layout parameters fig.subplots_adjust(hspace=0.125, wspace=0.125) # Create Seaborn boxplot for all the subplots sns.boxplot(ax=axes[0, 0]) sns.boxplot(ax=axes[0, 1]) sns.boxplot(ax=axes[1, 0]) sns.boxplot(ax=axes[1, 1]) # Display the plot plt.show()
Output
It will produce the following output −
- Related Articles
- How to adjust the space between legend markers and labels in Matplotlib?
- How to adjust transparency (alpha) in Seaborn pairplot using Matplotlib?
- How to remove the space between subplots in Matplotlib.pyplot?
- Manipulation on vertical space in Matplotlib subplots
- Manipulation on horizontal space in Matplotlib subplots
- How to plot multiple histograms on same plot with Seaborn using Matplotlib?
- Auto adjust font size in Seaborn heatmap using Matplotlib
- How to save a plot in Seaborn with Python (Matplotlib)?
- How to plot multiple Seaborn Jointplot in Subplot using Matplotlib?
- How to plot two Seaborn lmplots side-by-side (Matplotlib)?
- Add minor gridlines to Matplotlib plot using Seaborn
- How to increase the spacing between subplots in Matplotlib with subplot2grid?
- How to plot a non-square Seaborn jointplot or JointGrid? (Matplotlib)
- How to share secondary Y-axis between subplots in Matplotlib?
- How to add a legend on Seaborn facetgrid bar plot using Matplotlib?

Advertisements