以下是簡單的資料集=
x = [7.5, 7.5, 17.5]
y = [393.198, 351.352, 351.352]
我正在尋找的輸出圖是由 -
plt.plot(x,y) #right angle looking plot
但是,當我在 Seaborn 中執行此操作時,我會得到奇怪的情節 -
sns.lineplot(x=x,y=y)
我不明白為什么 Seaborn 會制作這個情節,以及如何修改 Seaborn 代碼以獲得由 Matplotlib 制作的情節?
uj5u.com熱心網友回復:
Seabornlineplot用于推斷 x/y 資料集之間的關系。因此,它正在計算一個估計量(默認情況下是平均值)來聚合公共 x 上的資料。
在這里,由于 x 是 7.5 的兩倍,它將這兩個點聚合為一個 y,即 393.198 和 351.352 的平均值。
您根本沒有使用 seaborn 的功能來制作它。如果您想要原始 matplotlib 圖,請直接使用 matplotlib。
uj5u.com熱心網友回復:
Seaborn 嘗試對資料進行一些估計和排序,以便更好地可視化 x 和 y (檔案)之間的關系。
下面的代碼生成與 matplotlib 相同的圖表
sns.lineplot(x=x,y=y, estimator=None, sort=False)
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/424604.html
標籤:Python matplotlib 海运
