px animations does not show correctly colors if all colors are not in the first frame
See original GitHub issueFor example
import pandas as pd
import plotly.express as px
dataVals = {
'Lat': [39.783730, 7, 39.783730, 39.783730, 20, -4.03, 39.783730, 36.82, 39.783730],
'Lon': [-100.445882, 66, -100.445882, -100.445882, 70, 5.33, -100.445882, -1.29, -100.445882],
'Value': [40, 12, 22, 3, 60, 23, 30, 100, 200],
'Year': ['1985', '1990', '1990', '1990', '1990', '1990', '2000', '2000', '2000'],
'Continent Color': ["a", "b", "a", "a", "b", "c", "b", "d", "a"]
}
data = pd.DataFrame(dataVals)
fig = px.scatter_geo(data, lat="Lat", lon="Lon", size="Value", color="Continent Color",
animation_frame="Year", animation_group="Continent Color",
projection="natural earth", size_max=200)
fig.show()
(all points are displayed with the color of continent “a”). Reported by https://community.plot.ly/t/scatter-geo-only-shows-values-with-a-certain-color-if-i-have-multiple-years-as-the-same-year/35976. Other functions such as px.scatter
have the same problem.
If all colors are used for the first frame, the problem disappears.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Plotly: How to make data consistent across animation frames ...
Animations are designed to work well when each row of input is present across all animation frames, and when categorical values mapped to...
Read more >animation on procreate
Create a new layer above the first (background) and draw the first frame for the animation. Don't fill the entire animation layer with...
Read more >Motion components | Framer for Developers
Complex strings containing multiple numbers and/or colors (ie "10px 0 #000" ). When animating to a non-animatable value like "block" , this value...
Read more >Animation | Jetpack Compose - Android Developers
.background(Color.Red) ) { // Content of the notification… } } } In some cases, you may want to have AnimatedVisibility apply no animations...
Read more >CSS Animations - W3Schools
To use CSS animation, you must first specify some keyframes for the animation. ... If the animation-duration property is not specified, no animation...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Are there any plans to improve this feature to make it work as expected? I use
animation_frame
a lot to group data that belongs together in conjunction withcolor
and would love to be able to leverage the expected behavior.hello @emmanuelle . I found a workaround for this, because i am also having trouble with animation on px. I didn’t modified the df, but i changed the approach of the color variable from categorical to numeric:
Here is the modified code. Hopefully it will help others: