使用带条形图的绘图下拉控件

2024-04-20 08:22:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直试图在我制作的条形图上应用一个下拉窗口小部件,但是在应用过滤器时遇到了问题。我一直在使用此文档指南:

https://plot.ly/python/dropdown-widget/

现在,我有一个这样的数据集设置:

id    happiness_score   time_of_day   
01             3                    08
02             4                    16
03             1                    22
04             2                    03
05             5                    16

我正在尝试创建一个条形图,分数是x轴,Id计数是y轴,时间是下拉窗口小部件。在

到目前为止,我已经能够创建widget,这需要一些时间,但是我是如何得到它的:

^{pr2}$

然而,它所做的只是忽略过滤器,并将一天中的所有id都绘制成图形,而不管分数如何。如果我按surveytime和score对dataframe fq进行分组,然后对id进行计数,则不会显示任何内容。在

如何将下拉过滤器应用于我制作的图形?在


Tags: 文档httpsid图形过滤器plot部件时间
1条回答
网友
1楼 · 发布于 2024-04-20 08:22:28

Plotly的开发团队找到我了。在

这是他们说的

We’re still working to clean out the old documentation, but the GraphWidget approach in that page is not the recommended approach at this point. The FigureWidget approach in plotly.py version 3 is much more capable and reliable.

I think the example in this page would be a good starting for you using FigureWidget: https://plot.ly/python/figurewidget-app/ 2

Hope that helps get you going,

相关问题 更多 >