เพื่อตั้งชื่อและเปลี่ยน scale ของแกน Seaborn kdeplot
- ตั้งค่าขนาดรูปและ padding ระหว่าง subplots
- สร้างข้อมูลสุ่มด้วย numpy
- พลอต Kernel Density Estimate (KDE) ด้วย kdeplot()
- ตั้ง Y-axis scale และ label
- แสดงรูปด้วย show()
ตัวอย่าง
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
data = np.random.randn(10)
k = sns.kdeplot(x=data, shade=True)
plt.yticks(k.get_yticks(), k.get_yticks())
plt.ylabel('Y', fontsize=7)
plt.show()ผลลัพธ์
