Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

วิธีใช้ factorplot ใน Seaborn visualize ข้อมูลใน Python

Seaborn visualize ข้อมูล barplot: categorical vs continuous point plot: จุดแทนค่าประมาณ factorplot: high-level function วาด categorical plot บน FacetGrid ด้วย 'kind' parameter (default: pointplot)

ตัวอย่าง

import pandas as pd
import seaborn as sb
from matplotlib import pyplot as plt
my_df = sb.load_dataset('exercise')
sb.factorplot(x="time", y="pulse", hue="kind", data=my_df)
plt.show()

ผลลัพธ์

วิธีใช้ factorplot ใน Seaborn visualize ข้อมูลใน Python

คำอธิบาย

  • นำเข้าแพ็กเกจ
  • โหลดข้อมูล 'exercise' จาก seaborn
  • เก็บใน DataFrame
  • ใช้ 'factorplot' (default kind='point')
  • ระบุ hue, x, y, data
  • แสดงผล

หมายเหตุ: factorplot ถูก deprecated ใน seaborn ใหม่ ใช้ catplot แทน