uirevision property doesn't keep the viewpoint consistent
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
The following is the copy-paste of a question I opened on stackoverflow, it looks like to be a bug, so here i go:
I'm trying to keep the viewpoint consistent in my plotly-dash web app after every callback. This should be straightforward according to many already answered questions. The following line of code should do the magic:
fig.update_layout(uirevision='constant')
Unfortunately for me, it looks like that this is not the case for 3D scatter plots, here is a very brief piece of code that should allow to reproduce my problem:
import plotly.express as px
df = px.data.iris()
import dash
from dash import dcc
from dash import html
from dash import Input, Output
app = dash.Dash()
app.layout = html.Div([
dcc.Dropdown(['option1', 'option2', 'option3'], 'axis', id='x-dropdown', clearable=False),
dcc.Graph(id='main-plot')
])
@app.callback(
Output('main-plot', 'figure'),
Input('x-dropdown', 'value'))
def update_figure(x_selector):
fig = px.scatter_3d(df, x='sepal_length', y='sepal_width', z='petal_width', color='species')
fig.update_layout(uirevision='constant')
return fig
app.run_server(debug=True, use_reloader=False)
I can tell that the uirevision is doing something since the viewpoint is not completely reset after the callback, but it is still very imprecise. Is there something I'm missing or is this the expected behavior?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the minimal Python Dash reproduction in the issue and observe the 3D scatter plot after changing the dropdown. Investigate how the uirevision layout setting affects the 3D viewpoint across callbacks; done means the viewpoint remains consistent after the callback without breaking the demonstrated plot behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100
