编码动画或条形图竞赛图

时间:2019-12-23 10:07:41

标签: python matplotlib plotly plotly-express

我想为以下数据集生成动画条形图。我通过以下方式创建了静态条形图:


plt.figure(figsize=(20,8))

graph = sns.countplot(data=enrich, x="Username")

plt.box(on=None)

graph.set_title("Q3 Enrichment", fontsize=30, pad=40)

graph.set_xlabel("CEE", fontsize=10)

graph.set_xticklabels(graph.get_xticklabels(), rotation=45)```

So I am wanting to the count 'Username' and using the 'Date Completed' as either the bar label or as the slider.

Stock Number    PSF_ID      Project         Hero / Non-Hero Date completed    Username        Team
694009         PSF_438980   SSE - RS PRO 2     Hero             01/10/2019     Name 1         RS PRO
1368299        PSF_438933   SSE - RS PRO 2     Hero             01/10/2019     Name 2         II&T
1774499        PSF_421233   RS PRO NPI         Hero             01/10/2019     Name 3         RS PRO

This is the code I've used so far to no avail:

enrich = px.data.gapminder()

fig = px.bar(enrich, x="Username", color="royal_blue",
  animation_frame="Date completed", range_y=[0,500])
fig.show()

0 个答案:

没有答案