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

พลอต Line Plot ด้วย Seaborn - Python Pandas

บทนำ

Line Plot ใน Seaborn ใช้ seaborn.lineplot() แสดงแนวโน้มข้อมูล ใช้ข้อมูล Cricketers.csv

โค้ดตัวอย่าง

import seaborn as sb
import pandas as pd
import matplotlib.pyplot as plt

dataFrame = pd.read_csv("C:\\Users\\amit_\\Desktop\\Cricketers.csv")
print("\nReading the CSV file...\n", dataFrame)

x = dataFrame['Age']
y = dataFrame['Height']
sb.lineplot(x, y)
plt.ylabel("Height (inches)")
plt.show()

ผลลัพธ์

ได้ Line Plot แสดงความสัมพันธ์ระหว่างอายุและความสูงของนักคริกเก็ต