Iām working with 3D Scatter plots where itās crucial to lock the turntable rotation to the Y-axis. The idea is to keep the Y-axis fixed while allowing rotation around it. While I understand that Plotlyās default behavior is to rotate around the Z-axis, this doesnāt meet my specific needs.
Iām aware of a trick where you can swap the Y and Z axes while adding traces, thereby giving the impression of Y-axis rotation. However, this approach isnāt suitable for my use case. My application deals with points that have meaningful X, Y, Z coordinates, and itās important for the users to know these values as they are.
Does anyone know a workaround for this issue? Or could this feature possibly be added in a future release?
Indeed, I am referring to rotation around the Y-axis when using the turntable rotation. I am working on visualizing some cuboids, 3D lines, and point clouds, where the Y-axis is designated as āup.ā Due to this orientation, turntable rotation around the default Z-axis is unintuitive for users who expect āupā to remain constant.
Unfortunately, using Dash apps is not an option for me; I need to create standalone HTML files for these visualizations.
Any insights or workarounds would be greatly appreciated!
Could you provide some sample data and code explaining why this does not work for you? I canāt check right now, but it should be possible to tweak axis labels and hoverinfo to give the user the ācorrectā impression.
Awesome hint and this solves my problem! I did not realize we can easily update hovertemplate for almost any 3D entity.
In case someone stumbles upon this, what I needed to do to enable this:
Swap Y and Z values whenever I use Scatter3D/Cone/Mesh3D
For each of the above, set up a hover template like "x=%{x:.3f}, y=%{z:.3f}, z=%{y:.3f}<br>"
Update the layout up direction and rename Y and Z axis: fig.update_layout( scene_camera={"up": {"x": 0.0, "y": 1.0, "z": 0.0}}, scene={ "dragmode": "turntable", "yaxis": {"title": "Z"}, "zaxis": {"title": "Y"}, }, )
With all these changes the code works exactly as intended.