Seaborn lineplot() รองรับพารามิเตอร์ linestyle เหมือน Matplotlib ตั้งค่า linestyle="dashed" (หรือ "--") เพื่อได้เส้นประ
ขั้นตอนการทำงาน
- ตั้งค่าขนาดรูปและเลย์เอาต์
- สร้างข้อมูล x, y
- พลอตด้วย
sns.lineplot(x=x, y=y, linestyle="dashed") - แสดงผล
ตัวอย่างโค้ด
import seaborn as sns
import numpy as np
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
x = np.random.rand(10)
y = np.random.rand(10)
ax = sns.lineplot(x=x, y=y, linestyle="dashed")
plt.show()
ผลลัพธ์
