Open
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?
Activity
dmalinverni commentedon Jul 24, 2023
Following up on @lpuglia's question, as I'm facing the same problem.
I've tried several combinations of uirevsion in layout and in scene, but with no success.
Are there any updates on this issue?
Thanks
jackhhchan commentedon Sep 30, 2023
Any update on this issue? I'm also experiencing the same thing
plotly 5.17.0
DoctorDinosaur commentedon Nov 20, 2023
Same issue for me, 3d scatter plot seems to ignore uirevision.
I'm instead having to store the state of the camera.
lpuglia commentedon Nov 20, 2023
@DoctorDinosaur can you share a workaround?
DoctorDinosaur commentedon Nov 20, 2023
Little buggy, but better than nothing. I'm sure someone with more experience can refine this.
mohsenminaei commentedon Dec 11, 2023
I have an observation that might be useful to whoever that's going to fix this problem.
I have a graph object Scatter3d plot. uirevision works fine when I update the plot data. But it breaks down when I maximize the browser tab (in general, change tab size). From that point on, the camera resets each time there is an update to the plot.
2 remaining items