Seaborn

Python for R Users

Daniel Chen

Instructor

Seaborn

  • barplots: barplot
  • histograms: histplot
  • boxplot: boxplot
  • scatter plot:regplot
  • Seaborn benefits
    • colored points by data
    • facet plots by data
Python for R Users

Seaborn histograms

import seaborn as sns
import matplotlib.pyplot as plt
sns.histplot(iris['sepal_length'], kde = True)
plt.show()

Python for R Users

Seaborn count plot

sns.countplot('species', data=iris)
plt.show()

Python for R Users

Seaborn boxplots

sns.boxplot(x='species', y='sepal_length', data=iris)
plt.show()

Python for R Users

Seaborn scatterplots

sns.regplot(x='sepal_length', y='sepal_width', data=iris)
plt.show() 

Python for R Users

Seaborn scatterplots w/out regression line

sns.regplot(x='sepal_length', y='sepal_width', data=iris,
            fit_reg=False)
plt.show()

Python for R Users

Seaborn facets

sns.lmplot(x='sepal_length', y='sepal_width', data=iris,
           fit_reg=False,
           col='species')
plt.show() 

Python for R Users

Seaborn FacetGrid

g = sns.FacetGrid(iris, col="species")
g = g.map(plt.hist, "sepal_length")
plt.show()

Python for R Users

Let's practice!

Python for R Users

Preparing Video For Download...