Geek Culture
Published in

Geek Culture

8 Best Seaborn Visualizations

Hands-on statistical plots with Seaborn using the penguin dataset.

Photo by Towfiqu barbhuiya on Unsplash

What is Seaborn?

pip install seaborn
import seaborn as sns
Penguin Dataset
data = sns.load_dataset("penguins")
The first five rows of the penguin dataset

(344, 7)
# For the image quality of the graphic.
# For the size of the graphics
sns.set(rc = {"figure.figsize":(6,3)})

1- Scatter Plot

sns.scatterplot( x = "bill_length_mm", 
y = "bill_depth_mm",
data = data,
hue = "species")
Scatter plot for penguins species

2. Histogram

sns.histplot(x = "flipper_length_mm", data = data)
Histogram plot for flipper length
sns.histplot(data=data, y="flipper_length_mm")
Flipped histogram plot
sns.histplot(data=data, x="flipper_length_mm", binwidth=3)
Histogram plot by controlling the width of bins
sns.histplot(data=data, x="flipper_length_mm", kde=True)
Histogram plot with kde
sns.histplot(data=data, x="flipper_length_mm", hue="species")
Histogram plot for penguin species

3. Bar Plot

sns.barplot(x = "species", y = "flipper_length_mm", data = data)
Bar plot for penguin species
sns.barplot(x = "species", 
y = "flipper_length_mm",
data = data,
hue = "sex")
Bar plot for penguin species by sex

4. Box Plot

sns.boxplot(x = "species", y = "flipper_length_mm", data = data)
Box plot for penguin species
sns.boxplot(x = "species", 
y = "flipper_length_mm",
data = data,
hue = "sex")
Box plot for penguin species by sex

5. Violin Plot

sns.violinplot(x = "species", y = "flipper_length_mm", data = data)
Box plot for penguin species
sns.violinplot(x = "species", 
y = "flipper_length_mm",
data = data,
hue = "sex")
Violin plot for penguin species by sex

6. Facet Grid

sns.FacetGrid(data, col="island", row="sex")
Facet grid
sns.FacetGrid(data, col="island", row="sex").map(sns.histplot, "flipper_length_mm")
Facet Grid with Histogram
sns.FacetGrid(data, col="island", row="sex").map(sns.distplot, "flipper_length_mm")
Facet Plot with displot

7. Pair Plot

sns.pairplot(data, hue="species", height=3)
Pair plot with kde
sns.pairplot(data, hue="species", diag_kind="hist")
Pair plot with histograms

8. Heatmap

sns.heatmap(data.corr(), annot=True)
Heapmap with numerical values


Data Visualization with Python

11 stories



A new tech publication by Start it up (

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store