I am overlaying 3D scatter markers on top of a semi-transparent 3D surface. I had disabled the hoverinfo
on the 3D surface so that my mouse cursor always snap to the nearest 3D marker. Everything works fine as long as the marker is above the surface. However, when a marker is underneath the 3D surface, I have to rotate the view to the other side of the surface so that I can select that 3D marker.
Is there any way to make the 3D markers that are underneath a 3D surface always selectable without having to rotate the view? Does Plotly has something like z-order?
If those 3D markers are inside a spherical 3D surface (or any closed 3D surface), is there any way to select/click on those markers? Thanks
1 Like
Here is the concrete example. I am trying to hover/click the (x,y,z) coordinate of the yellow marker inside the closed 3D surface.
import numpy as np
import plotly.graph_objects as go
a, b, d = 1.32, 1., 0.8
c = a**2 - b**2
u, v = np.mgrid[0:2*np.pi:100j, 0:2*np.pi:100j]
x = (d * (c - a * np.cos(u) * np.cos(v)) + b**2 * np.cos(u)) / (a - c * np.cos(u) * np.cos(v))
y = b * np.sin(u) * (a - d*np.cos(v)) / (a - c * np.cos(u) * np.cos(v))
z = b * np.sin(v) * (c*np.cos(u) - d) / (a - c * np.cos(u) * np.cos(v))
fig = go.Figure(
go.Surface(x=x, y=y, z=z, opacity=0.5, showscale=False))
fig.add_trace(
go.Scatter3d(
x=[-1],
y=[0],
z=[0],
mode='markers',
marker_color='yellow',
marker_size=30))
fig.update_layout(
height=800)
fig.show()
1 Like