How to make subplots in Seaborn

You can make subplots in Seaborn with the following code. The given example helps you to understand how to make subplots in Seaborn. I highly recommend you “Python Crash Course Book” to learn Python.

Example: Subplots in Seaborn

# Import the required libraries
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# Load the Dataset
dataset = sns.load_dataset('iris')

# Make Subplots
fig, ax = plt.subplots(1, 2)
sns.boxplot(x="species", y="sepal_length", data=dataset, ax=ax[0])
sns.boxplot(x="species", y="petal_length", data=dataset, ax=ax[1])

# Display the Output


Leave a Comment

Your email address will not be published.