BASICS
Create a Simple Scatter Plot
Explore the concepts and examples below to master this topic.
import seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset("penguins")
sns.scatterplot(x='bill_length_mm', y='bill_depth_mm', data=df)
plt.show()
Create a Histogram to Visualize Distribution
Explore the concepts and examples below to master this topic.
sns.histplot(df['body_mass_g'], bins=20, kde=True)
plt.show()
INTERMEDIATE
Create a Boxplot to Show Outliers
Explore the concepts and examples below to master this topic.
sns.boxplot(x='species', y='body_mass_g', data=df)
plt.show()
Customize Seaborn Theme for Better Visualization
Explore the concepts and examples below to master this topic.
sns.set_theme(style="darkgrid")
sns.scatterplot(x='flipper_length_mm', y='body_mass_g', data=df)
plt.show()
ADVANCED
Create a Heatmap for Correlation Matrix
Explore the concepts and examples below to master this topic.
import numpy as np
correlation_matrix = df.corr()
sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm')
plt.show()
Generate a Pairplot for Multivariate Analysis
Explore the concepts and examples below to master this topic.
sns.pairplot(df, hue='species')
plt.show()
Use the reference cards below for fast lookup. Perfect for brushing up on syntax while you cook your code. ๐ณ
import seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset("penguins")
sns.scatterplot(x='bill_length_mm', y='bill_depth_mm', data=df)
plt.show()
sns.histplot(df['body_mass_g'], bins=20, kde=True)
plt.show()
sns.boxplot(x='species', y='body_mass_g', data=df)
plt.show()
sns.set_theme(style="darkgrid")
sns.scatterplot(x='flipper_length_mm', y='body_mass_g', data=df)
plt.show()
import numpy as np
correlation_matrix = df.corr()
sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm')
plt.show()
sns.pairplot(df, hue='species')
plt.show()
Recipe Complete! ๐
You've explored the full Seaborn recipe.
Keep practising โ a language a day keeps AI away! ๐ค