sns.pairplot set figszie in python

To set the figure size of a pairplot in Python using seaborn, you can use the plt.figure function from matplotlib library.

Here is an example code snippet that demonstrates how to set the figure size:

main.py
import seaborn as sns
import matplotlib.pyplot as plt

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

# Set the figure size
plt.figure(figsize=(8, 8))

# Create the pairplot
sns.pairplot(iris)

# Show the plot
plt.show()
222 chars
15 lines

In the code above, the plt.figure(figsize=(8, 8)) line sets the figure size to 8x8 inches. You can adjust the width and height values according to your preference.

Make sure to import the necessary libraries, seaborn and matplotlib, and replace iris with your own dataset if needed.

Hope this helps!

related categories

gistlibby LogSnag