Text label for points not showing up

Hi
Iโ€™m new to plotly. Iโ€™m creating a simple tree chart with Scatter. The text is a list of strings intended for labeling each data point on chart. For some reason, the label does not show up unless I use annotation to forcefully add it to each data point. Could you let me what setting do I need to do to trigger the label to appear on each datapoint? Thanks.

dots = go.Scatter(x=Xn,
                  y=Yn,
                  mode='markers',
                  name='',
                  marker=dict(symbol='circle',
                                size=18,
                                color=v_lable_weight,
                                colorscale='Viridis',
                                showscale=True,
                                line=dict(color='rgb(50,50,50)', width=1)
                                ),
                  text=labels,
                  hovertext=v_label_path,
                  hoverinfo='text',
                  opacity=0.8
                  )

layout = dict(title= 'HDSS Tree',
              font=dict(size=12),
              showlegend=False,
              xaxis=go.layout.XAxis(axis),
              yaxis=go.layout.YAxis(axis),
              margin=dict(l=40, r=40, b=85, t=100),
              hovermode='closest',
              plot_bgcolor='rgb(248,248,248)'
              )

data=[lines, dots]
fig=dict(data=data, layout=layout)
plotly.offline.plot(fig,auto_open=True)

Hi @elgnoh,

The scatter.mode property controls this. If you want to show the markers and the text set the mode to "markers+text".

Hope that helps!
-Jon

1 Like