In [1]:
import numpy as np
from numpy.random import randn
import pandas as pd

from scipy import stats

import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns

%matplotlib inline

In [2]:
tips = sns.load_dataset('tips')

In [3]:
sns.lmplot('total_bill', 'tip', tips)


Out[3]:
<seaborn.axisgrid.FacetGrid at 0x107108dd0>

In [4]:
sns.lmplot('total_bill', 'tip', 
           tips, scatter_kws={'marker':'o', 'color': 'red'},
          line_kws={'linewidth':1, 'color': 'blue'})


Out[4]:
<seaborn.axisgrid.FacetGrid at 0x107108f90>

In [5]:
sns.lmplot('total_bill', 'tip', tips, order='4', 
          scatter_kws={'marker':'o', 'color': 'red'},
          line_kws={'linewidth':1, 'color': 'blue'})


Out[5]:
<seaborn.axisgrid.FacetGrid at 0x11c646490>

In [6]:
sns.lmplot('total_bill', 'tip', tips, fit_reg=False)


Out[6]:
<seaborn.axisgrid.FacetGrid at 0x11c67d0d0>

In [7]:
tips['tip_pect'] = 100* (tips['tip']/tips['total_bill'])

In [8]:
tips.head()


Out[8]:
total_bill tip sex smoker day time size tip_pect
0 16.99 1.01 Female No Sun Dinner 2 5.944673
1 10.34 1.66 Male No Sun Dinner 3 16.054159
2 21.01 3.50 Male No Sun Dinner 3 16.658734
3 23.68 3.31 Male No Sun Dinner 2 13.978041
4 24.59 3.61 Female No Sun Dinner 4 14.680765

In [9]:
sns.lmplot('size', 'tip_pect', tips)


Out[9]:
<seaborn.axisgrid.FacetGrid at 0x11cf81050>

In [10]:
sns.lmplot('size', 'tip_pect', tips, x_jitter=.1)


Out[10]:
<seaborn.axisgrid.FacetGrid at 0x11d4cfc50>

In [11]:
sns.lmplot('size', 'tip_pect', tips, x_estimator=np.mean)


Out[11]:
<seaborn.axisgrid.FacetGrid at 0x11d4cf690>

In [12]:
sns.lmplot('total_bill', 'tip_pect', tips, hue='sex', markers=['x', 'o'])


Out[12]:
<seaborn.axisgrid.FacetGrid at 0x11d6e6310>

In [13]:
sns.lmplot('total_bill', 'tip_pect', tips, hue='day')


Out[13]:
<seaborn.axisgrid.FacetGrid at 0x11d8abcd0>

In [14]:
sns.lmplot('total_bill', 'tip_pect', tips, lowess=True, line_kws={'color': 'black'})


Out[14]:
<seaborn.axisgrid.FacetGrid at 0x11dfd0850>

In [15]:
sns.regplot('total_bill', 'tip_pect', tips)


Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x11e041950>

In [19]:
fig, (axis1, axis2) = plt.subplots(1, 2, sharey=True)

sns.regplot('total_bill', 'tip_pect', tips, ax=axis1)
sns.violinplot(x = tips['tip_pect'], y = tips['size'])


Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x11fa80a90>

In [ ]: