Hi everyone
Is it possible to have a unique name or id or … to refer to a drawn object. For example in the below code to update any line data, I have to refer them by the order of drawing them. But I need to assign a unique name (for example assign ‘L2nd’ to the second line) then I update the second line data by calling it’s unique name (‘L2nd’). What should I do for this purpose?
import plotly.graph_objects as go
fig = go.Figure()
# Create scatter trace of text labels
fig.add_trace(go.Scatter( x=[0, 6], y=[0, 1], mode="lines"))
fig.add_trace(go.Scatter( x=[1, 7], y=[0, 1], mode="lines"))
fig.add_trace(go.Scatter( x=[2, 8], y=[0, 1], mode="lines"))
fig.add_trace(go.Scatter( x=[3, 9], y=[0, 1], mode="lines"))
fig.data[0].x=[0, 8]
fig.data[1].x=[2, 5]
fig.data[2].x=[3, 4]
fig.data[3].x=[1, 4]
fig.show()