Data Visualization using Strip Plot (Seaborn Library)

Home » News » Data Visualization using Strip Plot (Seaborn Library)
Lets visualize our data with Strip Plot which is present in Seaborn library. We can also use Strip Plot in conjunction with Box Plot and Violin Plot.


We can pass various parameters to stripplot like jitter, hue, dodge, order, palette, color, edgecolor, alpha, linewidth, marker, size etc. 


Lets explore Strip Plot using Tips dataset.

Step 1: Import required libraries


import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline


Step 2: Load Tips dataset


tips=sns.load_dataset(‘tips')
tips.head()


Step 3: Explore data using Strip Plot


Strip Plot is both univariate and bivariate. Lets analyze it first by using one variable and then we will use two variables. 

Visualizing one variable using Strip Plot


sns.stripplot(x=tips[‘tip'])


sns.stripplot(x=tips[‘total_bill'])


sns.stripplot(x='total_bill', data=tips)


sns.stripplot(x='total_bill', data=tips, color='green')

Visualizing two variables using Strip Plot


sns.stripplot(x='day', y='total_bill', data=tips)


sns.stripplot(x='total_bill', y='day', data=tips)


Add jitter parameter


sns.stripplot(x='day', y='total_bill', data=tips, jitter=False)


sns.stripplot(x='day', y='total_bill', data=tips, jitter=0.3)


sns.stripplot(x='day', y='total_bill', data=tips, jitter=0.3, linewidth=1.2)


Add hue and dodge parameter


sns.stripplot(x='day', y='total_bill', data=tips, hue='sex')


sns.stripplot(x='day', y='total_bill', data=tips, hue='sex', jitter=False)


sns.stripplot(x='day', y='total_bill', data=tips, hue='sex', dodge=True)


sns.stripplot(x='day', y='total_bill', data=tips, hue='sex', dodge=True, palette='winter_r')


sns.stripplot(x='day', y='total_bill', data=tips, hue='sex', dodge=True, palette='winter_r', order=[‘Sat', ‘Sun', ‘Thur', ‘Fri'])


sns.stripplot(x='day', y='total_bill', data=tips, hue='sex', dodge=True, marker='D')


sns.stripplot(x='day', y='total_bill', data=tips, hue='sex', dodge=True, marker='D', size=10)


sns.stripplot(x='day', y='total_bill', data=tips, hue='sex', dodge=True, marker='D', size=10, edgecolor='gray', alpha=0.3)

Combining Strip Plot and Box Plot


sns.stripplot(x='day', y='total_bill', data=tips)
sns.boxplot(x='day', y='total_bill', data=tips)


sns.stripplot(x='day', y='total_bill', data=tips, jitter=False, palette='husl', color=0.1)
sns.boxplot(x='day', y='total_bill', data=tips)

Combining Strip Plot and Violin Plot


sns.stripplot(x='day', y='total_bill', data=tips, jitter=False, palette='husl', color=0.1)
sns.violinplot(x='day', y='total_bill', data=tips)


sns.stripplot(x='day', y='total_bill', data=tips, jitter=False, palette='husl', color=0.1)
sns.violinplot(x='day', y='total_bill', data=tips, color='grey')


You can download my Jupyter notebook from here. I recommend to also try above code with Iris dataset.

Leave a Reply

Your email address will not be published. Required fields are marked *

New Providers
Quotex

1000+ Trading Instruments
The best trading broker in the world.

Stockity

1000+ Trading Instruments
The best trading broker in the world.

New Games
Lies of P

$59.99 Standard Edition
28% Save Discounts
See Top 10 Provider Games

COCOON

$24.99 Standard Edition
28% Save Discounts
See Top 10 Provider Games

New Offers
Commission up to $1850 for active user of affiliate program By Exness

Top Points © Copyright 2023 | By Topoin.com Media LLC.
Topoin.info is a site for reviewing the best and most trusted products, bonus, offers, business service providers and companies of all time.

Discover more from Topoin

Subscribe now to keep reading and get access to the full archive.

Continue reading