Annotate 3D scatter plot

Hi there,

I try to add annotations to the plotly 3d scatter plot, and I want to annotate several significant points. I have read the text and annotation documentation and I tried this code:

plot_ly(comb, x = ~b0.t, y = ~b1.t, z = ~b2.t,
             marker = list(size = 3,color = -log10(comb$comb.q), colorscale = 'Greens',reversescale =T, showscale = T)) %>%
             add_markers() %>%
             layout(scene = list(xaxis = list(title = 'b0'),
                                yaxis = list(title = 'b1'),
                                zaxis = list(title = 'b2')),
                    annotations = list( x = 7.176940, y = 4.548018, z = 5.518532, xref = 'x', yref='y',zref = 'z',
                                        ax = 50, ay = 0, text = "one", arrowhead =1, xanchor = 'left', yanchor = 'bottom'

But the annotations seem to use the paper as the reference

I want the plot look like HYRY’s plot in https://stackoverflow.com/questions/10374930/matplotlib-annotating-a-3d-scatter-plot

and without overlapping…, so how to annotate them?

1 Like