我有以下熊貓數據幀df
:如何爲我的數據集創建多線圖?
df = pd.DataFrame(columns=["Event1", "Event2", "Event3"],
data=[[15,1,22],
[16,1.26,80],
[27,0,15]])
df = df.set_index([["Series1", "Series2", "Series3"]])
我想創建與含有Event1
,Event2
和Event3
X軸的多情節,而Y軸應該是對應數值。應該有3個系列:Series1
,Series2
,Series3
。
如何定義x
,y
和hue
in sns.pointplot(x=???, y=???, hue=???,data=df)
?
plt.figure(figsize=(12,8))
ax = sns.pointplot(x=???, y=???, hue=???,data=df)
ax.grid(b=True, which='major', color='#d3d3d3', linewidth=1.0)
ax.grid(b=True, which='minor', color='#d3d3d3', linewidth=0.5)
plt.show()
纔是目的使用'sns.pointplot'或獲得獲得所希望的描繪的最簡單的方法? – ImportanceOfBeingErnest
@ImportanceOfBeingErnest:理想情況下,我想使用seaborn的'pointplot'。但我也接受純粹的'matplotlib'。 – Dinosaurius