我根据销售人员为每个客户计算了绿色/橙色/红色: 比如:
sellor customer red green orange
0 73 c1 5 96 15
1 77 c1 88 18 79
2 97 c1 58 59 71
我可以用它来构建:
^{pr2}$现在我想用图形表示数据: 现在我想:
for customer in df.customer.unique():
df[df.customer==customer].plot.bar(title=customer)
这给了我4张图片,如下所示:
我想我也可以用seaborn FaceGrid做同样的事情,但没有找到真正的方法。 我试过了:
sns.barplot(data=df, x="sellor", y="red", hue="customer")
但它只给了我一个地块(没有按客户细分)+它没有给我卖家的3个小节:(
如何使用facetgrid获得与循环相同的结果?在
不使用seaborn,您可以将条形图绘制为同一图形的不同子图
你可以通过seaborn的FaceGrid实现类似的功能
^{pr2}$最后,要更改此处使用的颜色以匹配数据帧名称,您可以设置颜色周期,例如
相关问题 更多 >
编程相关推荐