Let's suppose I have a plotly graph_objects.Figure
object containing a scatterplot:
y = np.random.rand(10)
x = np.random.rand(10)
names = ['A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'L']
fig = go.FigureWidget()
fig.add_trace(go.Scatter(
x=x,
y=y,
name='Base scatter',
mode='markers',
marker=dict(size=7),
customdata = names,
hovertemplate= '<b>x:</b> %{x}<br><b>y:</b> %{y}<br><b>Name:</b> %{customdata}<br>'))
fig.update_layout(title='Test')
fig.show()
Which produces the following image:
I would like that upon click on two different points, a new temporary plot appears with information about the two points (e.g. those two points in another canvas connected by a line).
I've looked into click handlers but I can't figure out how to make it work.
Thanks