我有以下熊猫数据帧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