plotly / plotly/plotly.py

Changing active slider value doesn't change the displayed data

Open
#3,276 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

How can I change the displayed data subset when using animation_frame? fig.update_layout(sliders=[dict(active=...)]), shown in the docs, only changes the value selected on the slider itself, but not the actual data. In this example, it's still showing the data associated with z=1 (notebook).

import plotly.express as px
import pandas as pd

df = pd.DataFrame(dict(x=[0, 1, 0, 1],
                       y=[0, 1, 1, 0],
                       z=[0, 0, 1, 1]))

fig = px.line(df, "x", "y", animation_frame="z")
fig.update_layout(sliders=[dict(active=1)])
fig.show()

enter image description here

Also posted to StackOverflow

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 with the reported Python example using Plotly Express animation_frame and fig.update_layout(sliders=[dict(active=1)]), then compare the slider selection with the displayed data in the linked notebook. Reproduce the mismatch and trace how the animation frame and slider state are handled; done means changing the active slider displays the corresponding data subset.

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.