เพื่อพล็อต Error Bars จาก DataFrame ด้วย Seaborn FacetGrid ให้ทำตามขั้นตอน:
- ได้ข้อมูลตาราง 2 มิติ ขนาดเปลี่ยนได้
- Multi-plot grid สำหรับพล็อตความสัมพันธ์เงื่อนไข
- ใช้ฟังก์ชันพล็อตบน subset ของข้อมูลแต่ละ facet
- ใช้ show() เพื่อแสดงรูป
ตัวอย่าง
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
df = pd.DataFrame({'col1': [3.0, 7.0, 8.0],
'col2': [1.0, 4.0, 3.0]})
g = sns.FacetGrid(df, col="col1", hue="col1")
g.map(plt.errorbar, "col1", "col2", yerr=0.75, fmt='o')
plt.show()ผลลัพธ์
