Hướng dẫn plot cdf python seaborn - cốt truyện cdf python seaborn

Trong bài viết này mình giới thiệu với mọi người các biểu đồ mình hay dùng để visualize dữ liệu bằng seaborn.

Nội dung chính

  • I. Seaborn vs Matplotlib
  • II. Các biểu đồ thường dùng trong seaborn
  • 2.1. Pair plots
  • 2.2. Countplot
  • 2.3. Histplot và Distplot (Trong version cũ của seaborn)
  • 2.4. Joint distributions
  • 2.5. Bar plots
  • 2.6. Heatmap
  • 2.7. Box plot, Swarm plot và Violin plot
  • 2.7.1. Box plot
  • 2.7.2. Swarm plot
  • 2.7.3. Violin plot ())
  • 2.8. Pie chart
  • III. Kết luận

Vì là intro nên để hiểu rõ hơn ý nghĩa của từng biểu đồ, mọi người có thể đọc thêm tại series data visualization của anh Ngọc tại đây và của anh Khánh tại đây

I. Seaborn vs Matplotlib

II. Các biểu đồ thường dùng trong seaborn

2.1. Pair plots

2.2. Countplot 2.3. Histplot và Distplot (Trong version cũ của seaborn)
2.4. Joint distributions 2.5. Bar plots2.6. Heatmap
2.7. Box plot, Swarm plot và Violin plot 2.7.1. Box plot2.7.2. Swarm plot
2.7.3. Violin plot ()) 2.8. Pie chartIII. Kết luận
Vì là intro nên để hiểu rõ hơn ý nghĩa của từng biểu đồ, mọi người có thể đọc thêm tại series data visualization của anh Ngọc tại đây và của anh Khánh tại đây Seaborn là mở rộng của matplotlib, có nghĩa là seaborn kế thừa từ matplotlib và cũng chính vì vậy, seaborn khong thể thay thế hoàn toàn được matplotlib.Mình sẽ so sánh nhanh giữa 2 tools visualize này nhé!

Matplotlib

Hướng dẫn plot cdf python seaborn - cốt truyện cdf python seaborn

Seaborn

II. Các biểu đồ thường dùng trong seaborn

Chức năng

# Import library
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Load data
tips = sns.load_dataset('tips')
iris = sns.load_dataset('iris')
planets = sns.load_dataset('planets')

2.1. Pair plots

2.2. Countplot

sns.pairplot(iris, hue='species', height=1.5)

2.3. Histplot và Distplot (Trong version cũ của seaborn)

2.4. Joint distributions

sns.countplot(x = tips['day'])

2.5. Bar plots

):
sns.countplot(x = tips['day'],
             order = tips['day'].value_counts().index)

2.6. Heatmap

sns.countplot(x= 'day', hue= 'sex', data= tips)

2.3. Histplot và Distplot (Trong version cũ của seaborn)

2.4. Joint distributions

sns.distplot(tips['total_bill'], bins= 7) # bins: chia ra thành bins cột

2.5. Bar plots

2.6. Heatmap

2.4. Joint distributions

2.5. Bar plots

2.6. Heatmap

2.7. Box plot, Swarm plot và Violin plot

# Load data
tips = sns.load_dataset('tips')
iris = sns.load_dataset('iris')
planets = sns.load_dataset('planets')
1

2.7. Box plot, Swarm plot và Violin plot

2.7.1. Box plot

2.7.2. Swarm plot

2.5. Bar plots

2.6. Heatmap

2.7. Box plot, Swarm plot và Violin plot

2.7.1. Box plot

2.7.2. Swarm plot

2.6. Heatmap

2.7. Box plot, Swarm plot và Violin plot

# Load data
tips = sns.load_dataset('tips')
iris = sns.load_dataset('iris')
planets = sns.load_dataset('planets')
2

2.7. Box plot, Swarm plot và Violin plot

2.7.1. Box plot

2.7.1. Box plot

# Load data
tips = sns.load_dataset('tips')
iris = sns.load_dataset('iris')
planets = sns.load_dataset('planets')
3

2.7.2. Swarm plot

2.7.3. Violin plot ())

# Load data
tips = sns.load_dataset('tips')
iris = sns.load_dataset('iris')
planets = sns.load_dataset('planets')
4

2.7.2. Swarm plot

2.7.3. Violin plot ())

2.7.3. Violin plot ())

# Load data
tips = sns.load_dataset('tips')
iris = sns.load_dataset('iris')
planets = sns.load_dataset('planets')
6

2.8. Pie chart

III. Kết luận

))
# Load data
tips = sns.load_dataset('tips')
iris = sns.load_dataset('iris')
planets = sns.load_dataset('planets')
7

III. Kết luận

Vì là intro nên để hiểu rõ hơn ý nghĩa của từng biểu đồ, mọi người có thể đọc thêm tại series data visualization của anh Ngọc tại đây và của anh Khánh tại đây

Seaborn là mở rộng của matplotlib, có nghĩa là seaborn kế thừa từ matplotlib và cũng chính vì vậy, seaborn khong thể thay thế hoàn toàn được matplotlib.

https://jakevdp.github.io/PythonDataScienceHandbook/04.14-visualization-with-seaborn.html