Clicktoshow on annotation in Scatter3d

Hi everyone, I am plotting annotations on a Scatter3d plot and would like to use the clicktoshow function that I find in layout.annotations, but I get “Invalid property specified for object of type plotly.graph_objs.layout.scene.Annotation: ‘clicktoshow’”.

Any idea if there’s a way to use it? Reproducible code below. Thanks!

import plotly.graph_objects as go

fig = go.Figure()

x,y,z= np.array([
    [0, 1, 2, 3, 4, 5, 6, 7, 8],
    [0, 1, 3, 2, 4, 3, 4, 6, 5],
    [0, 2, 3, 5, 4, 6, 4, 6, 5]
])

fig.add_trace(go.Scatter3d(
    x=x,
    y=y,
    z=z
    )
)

annotations = [dict(x=x[i],y=y[i],z=z[i],text=str(x[i]),font=dict(size=10, color="white"),bgcolor="black",
#              clicktoshow=False,        #<---this is the incriminated line
            ) for i in range(len(x))]

fig.update_layout(scene=dict(annotations=annotations))

fig.show()

Hi matteograsso,

I have no experience in plotly but in the documentation there exist two different annotation in the Layout:

"Layout.annotation" This includes the Clicktoshow property that you mentioned. :slightly_smiling_face:

and

"Layout.scene.annotation" That do not. :woozy_face:

I did not realize that, thank you very much! I will see if I can do what I want without “making a scene”.

1 Like