## Pages

Machine Learning Quiz (134 Objective Questions) Start ML Quiz

Deep Learning Quiz (205 Objective Questions) Start DL Quiz

## Sunday, 14 April 2019

### 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 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)

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)

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.