Skip to content

px.scatter_mapbox animation issue: color shows the 1st frame and won't update #4068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Lisazhiyuan opened this issue Feb 13, 2023 · 3 comments
Labels
bug something broken

Comments

@Lisazhiyuan
Copy link

Lisazhiyuan commented Feb 13, 2023

Please see the test csv file and code below. And Thank you so much!

The goal is to show all points on the map with different color ["EV"]: if "EV" is 1, show red; "0" show blue. As year goes, variable "EV" is changing from 0 to 1, expecting color changing from blue to red. However, the color stays at 1st frame and cannot updating as time goes. Even when I hover on the dots and see the EV value has updated, the dot color is not changing.

All points ("parcel_id") are consistent and included throughout frames (year 1 to 10). For the 1st frame (year1), there are both red and blue (EV=1 and EV=0).

I can see color changing if I am using px.scatter animation (same code, just change x=df['Lat'], y=df['Long']). But I really need to show these dots on map. Why it's not working with scatter_mapbox? Can scatter_mapbox handle this? Thanks a lot!

test data
test.csv

df = pd.read_csv("test.csv")
px.set_mapbox_access_token(open(".mapbox_token").read())
fig = px.scatter_mapbox(df, lat=df['Lat'],
lon=df['Long'],
color=df["EV"],
size = df["EV"]+1,
color_continuous_scale= [[0, "rgb(17, 141, 255)"],[1, "rgb(161,52,60)"]],
animation_frame="Year",
animation_group= "parcel_id",
title="EV Adoption")
fig.update_layout(mapbox_style="open-street-map")
fig.show()

image

@Lisazhiyuan Lisazhiyuan changed the title scatter_mapbox animation issue: color suppost to change for the same dot during frames. Only shows the 1st frame and won't update scatter_mapbox animation issue: color shows the 1st frame and won't update Feb 13, 2023
@Lisazhiyuan Lisazhiyuan changed the title scatter_mapbox animation issue: color shows the 1st frame and won't update px.scatter_mapbox animation issue: color shows the 1st frame and won't update Feb 13, 2023
@AaronStiff
Copy link
Contributor

Hi @Lisazhiyuan. This seems to be working for me in Chromium (Brave) with current versions of Plotly.py and Plotly.js. What versions are you using, and does this happen in other browsers?

@Lisazhiyuan
Copy link
Author

Thanks so much Aaron! I was using 5.11.0 version. After updating to 5.13.0, the issue disappears. Both Microsoft Edge and Chrome brower work!

@AaronStiff
Copy link
Contributor

Awesome! No problem.

@AaronStiff AaronStiff added the bug something broken label Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

2 participants