Giới thiệu trực quan dữ liệu với Seaborn
Content Team
DataCamp
Biểu đồ quan hệ

Biểu đồ quan hệ

Biểu đồ quan hệ



Vì sao dùng relplot() thay cho scatterplot()?
relplot() cho phép tạo nhiều biểu đồ con trong một hìnhDùng scatterplot()
import seaborn as sns
import matplotlib.pyplot as plt
sns.scatterplot(x="total_bill",
y="tip",
data=tips)
plt.show()
Dùng relplot()
import seaborn as sns
import matplotlib.pyplot as plt
sns.relplot(x="total_bill",
y="tip",
data=tips,
kind="scatter")
plt.show()
import seaborn as sns import matplotlib.pyplot as plt sns.relplot(x="total_bill", y="tip", data=tips, kind="scatter", col="smoker")plt.show()

import seaborn as sns import matplotlib.pyplot as plt sns.relplot(x="total_bill", y="tip", data=tips, kind="scatter", row="smoker")plt.show()

import seaborn as sns import matplotlib.pyplot as plt sns.relplot(x="total_bill", y="tip", data=tips, kind="scatter", col="smoker", row="time")plt.show()


import seaborn as sns import matplotlib.pyplot as plt sns.relplot(x="total_bill", y="tip", data=tips, kind="scatter", col="day", col_wrap=2)plt.show()

import seaborn as sns import matplotlib.pyplot as plt sns.relplot(x="total_bill", y="tip", data=tips, kind="scatter", col="day", col_wrap=2, col_order=["Thur", "Fri", "Sat", "Sun"])plt.show()

Giới thiệu trực quan dữ liệu với Seaborn