Seaborn visualize ข้อมูล มี theme และ high-level interface ข้อมูลจริงมีหลายตัวแปร ต้องการวิเคราะห์ความสัมพันธ์ทุกคู่ bivariate distribution อาจซับซ้อน ใช้ 'pairplot' สำหรับ multiple pairwise bivariate distribution ได้ univariate plots
Syntax pairplot
seaborn.pairplot(data, ...)
ตัวอย่าง
import pandas as pd
import seaborn as sb
from matplotlib import pyplot as plt
my_df = sb.load_dataset('iris')
sb.set_style("ticks")
sb.pairplot(my_df, hue='species', diag_kind="kde", kind="scatter", palette="husl")
plt.show()
ผลลัพธ์


คำอธิบาย
- นำเข้าแพ็กเกจ
- โหลดข้อมูล 'iris' จาก seaborn
- เก็บใน DataFrame
- ใช้ 'pairplot' hue='species' diag_kind='kde' (kernel density estimation บน diagonal) kind='scatter' palette='husl'
- แสดงผล
Pairplot แสดง scatter plot matrix ทุกคู่ของตัวแปร พร้อม KDE บนแนวทแยง