带有海洋色相的色相堆积条形图问题

时间:2020-08-06 07:02:59

标签: stack bar-chart hue stacked

我正在努力解决以下问题:

使用这些变量:

'''

         Outlet_Type  Item_Outlet_Sales Item_Fat_Content
0     Supermarket Type1          3735.1380          Low Fat
1     Supermarket Type2           443.4228          Regular
2     Supermarket Type1          2097.2700          Low Fat
3         Grocery Store           732.3800          Regular
4     Supermarket Type1           994.7052          Low Fat
...                 ...                ...              ...
8518  Supermarket Type1          2778.3834          Low Fat
8519  Supermarket Type1           549.2850          Regular
8520  Supermarket Type1          1193.1136          Low Fat
8521  Supermarket Type2          1845.5976          Regular
8522  Supermarket Type1           765.6700          Low Fat

'''

我想设置“ Item_Fat_Content,然后放样”。

使用

'''

sns.barplot(x='Outlet_Type', y = "Item_Outlet_Sales", hue ='Item_Fat_Content',
            data = df2, estimator = sum)
plt.xticks(rotation=45)
plt.ylabel("Item_Sales_Sum")

''' 可以:

enter image description here

但是,如果我添加

'''

stack = True 
#or
stacked = True

'''

然后我得到“ AttributeError:'Rectangle'对象没有'stacked'属性”

我发现的解决方案对我来说似乎很难理解,并且与我的特定问题不太相关。我想知道是否有一个简单的解决方案

非常感谢

0 个答案:

没有答案