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

วิธีใช้ Seaborn visualize Point Plots ใน Python

Seaborn visualize ข้อมูล barplot: เข้าใจ central tendency ของการกระจายข้อมูล แสดงความสัมพันธ์ categorical vs continuous point plot: คล้าย bar plot แต่แสดงจุดประมาณค่าที่ความสูงเฉพาะแกน

ตัวอย่าง

import pandas as pd
import seaborn as sb
from matplotlib import pyplot as plt
my_df = sb.load_dataset('titanic')
sb.pointplot(x="sex", y="survived", hue="class", data=my_df)
plt.show()

ผลลัพธ์

วิธีใช้ Seaborn visualize Point Plots ใน Python

คำอธิบาย

  • นำเข้าแพ็กเกจ
  • โหลดข้อมูล 'titanic' จาก seaborn
  • เก็บใน DataFrame
  • ใช้ 'pointplot' visualize
  • ระบุ dataframe, x, y, hue
  • แสดงผล

Point plot แสดง confidence interval (bootstrapped) ช่วยเปรียบเทียบกลุ่มได้ชัดเจนกว่า bar plot