plotly / plotly/dash

Responsive Graphs Ignore "uirevision"

Open
#2,595 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Describe your context
Please provide us your environment, so we can easily reproduce the issue.

Python 3.11

  • replace the result of pip list | grep dash below
dash                 2.11.1
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table           5.0.0
plotly  5.15.0
  • if frontend related, tell us your Browser, Version and OS

    • OS: Windows 10
    • Browser: Firefox
    • Version 115.0.1
      (also occurs with Chrome 114.0.5735.199)

Describe the bug

When a graph is set as "responsive=True" in dash, it ignores the setting fig["layout"]["uirevision"] = "constant", and the camera is reset every time the figure updates.

Expected behavior

When the parameter fig["layout"]["uirevision"] is set to a constant, the graph should not change camera position etc when replotting new data, unless the constant is changed.

Screenshots

I've created a minimal script which reproduces the bug:

from dash import Dash, dcc, html, Input, Output
import plotly.express as px

app = Dash(__name__)

app.layout = html.Div(
    [
        dcc.RadioItems(
            ["sepal_length", "sepal_width", "petal_width"],
            "petal_width",
            id="radio-colour",
        ),
        dcc.Graph(
            id="graph",
            responsive=True, # comment out this line
        ),
    ]
)


@app.callback(
    Output("graph", "figure"),
    Input("radio-colour", "value"),
)
def update_bar_chart(colour_scheme):
    df = px.data.iris()
    fig = px.scatter_3d(
        df, x="sepal_length", y="sepal_width", z="petal_width", color=colour_scheme
    )
    fig["layout"]["uirevision"] = "a"
    return fig


app.run_server(debug=True)

The graph resets its camera every time you click the radio buttons to update the colour scheme. If the responsive=True, # comment out this line line is commented out, the graph behaves as it should.

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 minimal Python Dash script in the issue with responsive=True, then compare it with the same script after removing that setting. Confirm that changing the radio button resets the 3D camera despite a constant layout uirevision, and that the camera remains stable when the issue is fixed.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.