Seaborn

In [19]:
import numpy as np
import pandas as pd
import seaborn as sns

%matplotlib inline
In [20]:
tips = sns.load_dataset('tips')

tips.head()
Out[20]:
total_bill tip sex smoker day time size
0 16.99 1.01 Female No Sun Dinner 2
1 10.34 1.66 Male No Sun Dinner 3
2 21.01 3.50 Male No Sun Dinner 3
3 23.68 3.31 Male No Sun Dinner 2
4 24.59 3.61 Female No Sun Dinner 4

Distribution Plot

In [21]:
sns.distplot(tips['total_bill'],bins=10)#kde=False)
Out[21]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a177da588>

Joint Plot

when dealing with Bi-variate data
In [22]:
sns.jointplot(x='total_bill',y='tip',data=tips, kind='hex')
Out[22]:
<seaborn.axisgrid.JointGrid at 0x1a179c45c0>

Pair Plot

In [23]:
sns.pairplot(data=tips, hue='sex',palette='coolwarm')
Out[23]:
<seaborn.axisgrid.PairGrid at 0x1a17c57550>

Rug Plot

-A rug plot is a graphical representation of data where the x- or y-values of individual data points are displayed as perpendicular hash marks along the corresponding axes of the graph - Wikipedia

In [24]:
sns.rugplot(tips['total_bill'])
Out[24]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a183bce10>

Categorical Plots

Bar Plot

In [25]:
sns.barplot(x='sex',y='total_bill',data=tips, estimator=np.std)
Out[25]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a187f9048>

Count Plot

With cumulative count based on 'sex' column
In [26]:
sns.countplot(x='sex', data=tips)
Out[26]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a188cd5c0>

Box Plot

In [27]:
sns.boxplot(x='day', y='total_bill', data=tips, hue='smoker')
Out[27]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a1883fba8>

Violin Plot

In [28]:
sns.violinplot(x='day', y='total_bill', hue='smoker',data=tips, split=True) #)
Out[28]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a189522e8>

Complex viz

Strip plot

In [29]:
sns.stripplot(x='day', y='total_bill', hue='smoker',data=tips, jitter=True, dodge=True)
Out[29]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a18d22e80>

Swarm Plot

In [30]:
sns.swarmplot(x='day', y='total_bill', hue='smoker',data=tips)
Out[30]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a18d16dd8>

Factor Plot

used directly to tweak supporting plot details or add other layers.
In [31]:
sns.factorplot(x='day', y='total_bill', hue='smoker',data=tips)
Out[31]:
<seaborn.axisgrid.FacetGrid at 0x1a18ca1e80>