【发布时间】:2021-05-09 03:55:57
【问题描述】:
我使用
将我的表格汇总到下表中test_df = countData_df
stackedTable = test_df.reset_index().pivot_table(values='volume', index=['address', 'direction'],
aggfunc='sum')
我想创建一个条形图,条形图上有四种颜色用于不同的方向。每个条形只能有两个选项:N 或 S; E或W
所以我完成了这条线
test_df.reset_index().pivot_table(values='volume', index=['address', 'direction'],
aggfunc='sum').plot(kind = 'bar', stacked = True, color = ['b','g','r','m'])
但显示如下
【问题讨论】:
标签: python pandas stacked-chart