英文:
Plotly scatter shows only shows first value in month, only hover for others
问题
I'm scatter-plotting a timeseries with hourly values per country. Additionally, I want to be able to show the development of hourly values per day throughout the years. My input data looks like this:
datetime | datetime_str | country | value1 | value2 |
---|---|---|---|---|
2014-12-07T23:00:00.000+0000 | 2014-12-07 | GB | 1234 | 5678 |
2014-12-08T00:00:00.000+0000 | 2014-12-08 | GB | 5436 | 9375 |
... |
The data is present as a pandas df. The plotting code (plotly) looks like this:
fig = px.scatter(plot_df, x="value1", y="value2", animation_frame="datetime_str", animation_group="country", color="country", hover_name="country")
fig.show()
The issue now is that the plot only shows the first value per day as an actual point inside the graph. For example, if "country" has five distinct values, for each day the plot only shows five values, while it should show 5*24 values. The other ones are present in the plot though, as hover labels get displayed if I hover over them.
How do I make plotly display the other values?
Edit:
In this image you can see an example:
英文:
I'm scatter-plotting a timeseries with hourly values per country. Additionally, I want to be able to show the development of hourly values per day throughout the years. My input data looks like this:
datetime | datetime_str | country | value1 | value2 |
---|---|---|---|---|
2014-12-07T23:00:00.000+0000 | 2014-12-07 | GB | 1234 | 5678 |
2014-12-08T00:00:00.000+0000 | 2014-12-08 | GB | 5436 | 9375 |
... |
The data is present as a pandas df. The plotting code (plotly) looks like this:
fig = px.scatter(plot_df, x="value1", y="value2", animation_frame="datetime_str", animation_group="country", color="country", hover_name="country")
fig.show()
The issue now is that the plot only shows the first value per day as an actual point inside the graph. For example, if "country" has five distinct values, for each day the plot only show five values, while it should show 5*24 values. The other ones are present in the plot though, as hover labels get displayed if I hover over them.
How do I make plotly display the other values?
答案1
得分: 0
问题是Plotly无法呈现每天的点数(“csv”模式仅能处理约1000个独立点)。我将呈现模式更改为WebGL,这在某种程度上使其工作。1
fig = px.scatter(plot_df, x="value1", y="value2", animation_frame="datetime_str", animation_group="country", color="country", hover_name="country", render_mode="webgl")
英文:
The problem was that plotly was unable to render the amount of points per day ("csv"-mode only work to about 1000 individual points). I changed the render mode to WebGL, which kinda made it work. (1)
fig = px.scatter(plot_df, x="value1", y="value2", animation_frame="datetime_str", animation_group="country", color="country", hover_name="country", render_mode="webgl")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论