-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
uirevision property doesn't keep the viewpoint consistent #3951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Following up on @lpuglia's question, as I'm facing the same problem. Are there any updates on this issue? |
Any update on this issue? I'm also experiencing the same thing plotly 5.17.0 |
Same issue for me, 3d scatter plot seems to ignore uirevision. I'm instead having to store the state of the camera. |
@DoctorDinosaur can you share a workaround? |
app = Dash(__name__)
app.layout = html.Div(
[
# ... Your dash elements
dcc.Store(id="camera"),
]
)
# Callback to store camera position
@app.callback(
dd.Output("camera", "data"),
dd.Input("graph", "relayoutData"),
)
def store_camera_position(relayoutData):
if relayoutData is not None:
if "scene.camera" in relayoutData:
return relayoutData["scene.camera"]
return no_update
# ... some code ....
@app.callback(
dd.Output("graph", "figure"),
# ... Your other callback stuff
dd.State("graph", "figure"),
dd.State("camera", "data"),
)
def your_callback_func(... , figure, camera):
if camera is not None:
figure["layout"]["scene"]["camera"] = camera
# ... The rest of your callback func
return figure Little buggy, but better than nothing. I'm sure someone with more experience can refine this. |
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. |
I'm experiencing this issue as well. DoctorDinosaur's workaround looks good, but in my application we server-generate our plots out as html and then render them. Haven't been able to get a similar camera sleight of hand working yet. |
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:
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:
This is what i'm observing:

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?The text was updated successfully, but these errors were encountered: