Timeline slider causes width flickering/glitching
Hello there!
Basically I’m using a px.density_mapbox for plotting animated coordinates over a map, and using a slider which allows users to “time-travel” over the coordinates. When I hit the play button it seems to work relatively fine, but when I update the slider manually the mapbox’s width starts filckering/glitching around, by this I mean it’s width changes randomly as shown in this video 2
I’ve expericenced this behaviour using plotly with streamlit as well as with jupyter-notebook (both notebook_connected and browser rendering modes)
Does anyone know what could be the cause for this? Thanks!
Code:
fig = px.density_mapbox(coords_df,
title=f"Some Nice title",
lat="lat",
lon="lon",
animation_frame="hour_minute",
animation_group="service_id",
radius=10,
)
fig.show()
I had the same problem - I see a lot of "Too many auto-margin redraws" in the browser console, so it might be related to https://github.com/plotly/plotly.js/issues/2704
The way I "fixed" it for now was to stop showing the colorbar and to stick automargin=False on every element that it would let me. It still happens a bit with the slider be it's a lot better, I think I'm going to just grab the color bar and pull it into the page separately as another image (mine doesn't need to change). Hacky, but it's better 🤷♂️
Here's what I'm trying to do: https://heathhenley.github.io/RhodyCarCounter/heatmap and here's the script: https://github.com/heathhenley/RhodyCarCounter/blob/main/scripts-utils-one-offs/plot_some_data.py#L36
If you slide the slider around a bit you can get it to flicker still, but because it's below the map I think it's not as jarring as the colorbar flickering. Maybe someone with more experience can tell what I've missed to stop the slider from automargin'ing everytime it's updated?
Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson
The flickering issue is still present as of plotly.py version 5.23.0
The new maplibre backend is still affected by the flickering issue as of 5.24.0.