Seaborn has been around for a long time.
I bet it is one of the most known and used libraries for data visualization because it is beginner friendly, enabling non-statisticians to build powerful graphics that help one extracting insights backed up by statistics.
I am not a statistician. My interest in the subject comes from Data Science. I need to learn statistical concepts to perform my job better. So I love having easy access to histograms, confidence intervals, and linear regressions with very low code.
Seaborn’s syntax is very basic: sns.type_of_plot(data, x, y). Using that simple template, we can build many different visualizations, such as barplot, histplot, scatterplot, lineplot, boxplot, and more.
But this post is not to talk about those. It is about other enhanced types of visualizations that can make a difference in your analysis.
Let’s see what they are.
To create these visualizations and code along with this exercise, just import seaborn using import seaborn as sns.
The dataset used here is the Student Performance, created by Paulo Cortez and donated to UCI Repository under the Creative Commons license. It can be directly imported in Python with the code below.
# Install UCI Repo
pip install ucimlrepo# Loading a dataset
from ucimlrepo import fetch_ucirepo
# fetch dataset
student_performance = fetch_ucirepo(id=320)
# data (as pandas dataframes)
X = student_performance.data.features
y = student_performance.data.targets
# Gather X and Y for visualizations
df = pd.concat([X,y], axis=1)
df.head(3)
Now let’s talk about the 5 visualizations.
1. Stripplot
The first plot picked is the stripplot. And you will quickly see why this is interesting. If we use this simple line of code, it will display the following viz.
# Plot
sns.stripplot(data=df);