问题描述
我已经使用groupby通过plotly库绘制了一个交互式绘图。
我想将此绘图从多个条形转换为堆叠的条形。
df.groupby(['event_type','groups']).size().unstack().iplot(kind='bar',bins=20,theme="white",title="Event type over groups",xTitle='event type',yTitle='Number of person')
解决方法
我发现答案只是添加 barmode ='stack'