plotly / plotly/plotly.py

Using a slider creates jitter on an animated scattermapbox

Open
#3,539 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3 performance
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

An animated scattermapbox figure with a legend sometimes shows jitter while using a slider.

import plotly.graph_objects as go


lats = [_*0.02 for _ in range(500)]
lons = [0]*500

fig = go.Figure()
fig.add_trace(go.Scattermapbox(lat=[0], lon=[0], visible="legendonly"))
fig.add_trace(go.Scattermapbox(lat=[0], lon=[0], showlegend=False))

frames = []

for lat, lon in zip(lats, lons):
    frame = go.Frame(data=go.Scattermapbox(lat=[lat], lon=[lon]),
                     traces=[1], name=str(lat))
    frames.append(frame)

fig.update(frames=frames)

fig.layout.mapbox.center = {"lat": 5, "lon": 0}
fig.layout.mapbox.style = "open-street-map"
fig.layout.mapbox.zoom = 4


def frame_args(duration):
    template = {"frame": {"duration": duration},
                "mode": "immediate",
                "fromcurrent": True,
                "transition": {"duration": 0}}
    return template


def step_dict(frame):
    template = {"args": [[frame.name], frame_args(0)],
                "label": frame.name,
                "method": "animate"}
    return template

steps = [step_dict(f) for f in fig.frames]

sliders = [{"steps": steps}]

fig.update_layout(sliders=sliders)

fig.show()

https://user-images.githubusercontent.com/9297904/148424735-cb11c162-ad21-437f-afc7-55447c06d659.mov

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied Python reproduction and observing the animated scattermapbox while moving its slider. Trace the slider and frame-animation handling from the resulting figure; done means the same legend-bearing figure no longer shows jitter during slider use. No source file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.