[英]Pandas - Plot stacked bar chart
I have a pandas dataframe representing a table with 2 columns and 4 rows 我有一个pandas数据帧表示一个包含2列和4行的表
Name | Value
n1 | 10.3
n2 | 5
n3 | 15
n4 | 8
I need to draw stacked bar (matplotlib) of values and the names should be shown in legend I tried this (with no success): 我需要绘制值的堆叠条(matplotlib),名称应该在图例中显示我试过这个(没有成功):
df.count().unstack('Total_Sales')
df.plot(kind='bar', stacked=True)
How can I do it? 我该怎么做? I saw this question Pandas - Plotting a stacked Bar Chart .
我看到了这个问题Pandas - 绘制一个堆积的条形图 。 Not sure how to use it in my case
不知道如何在我的情况下使用它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.