Seaborn

Python pentru utilizatori de R

Daniel Chen

Instructor

Seaborn

  • diagrame de bare: barplot
  • histograme: histplot
  • diagrame box: boxplot
  • diagrame de dispersie: regplot
  • Avantaje Seaborn
    • colorarea punctelor după date
    • grafice facetate după date
Python pentru utilizatori de R

Histograme Seaborn

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

Python pentru utilizatori de R

Diagramă de numărare Seaborn

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

Python pentru utilizatori de R

Diagrame box Seaborn

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

Python pentru utilizatori de R

Diagrame de dispersie Seaborn

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

Python pentru utilizatori de R

Diagrame de dispersie Seaborn fără linie de regresie

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

Python pentru utilizatori de R

Facete Seaborn

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

Python pentru utilizatori de R

Seaborn FacetGrid

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

Python pentru utilizatori de R

Să exersăm!

Python pentru utilizatori de R

Preparing Video For Download...