Hi,
I have a simple scatter plot on top of which I hand-annotated some shapes using drawopenpath
. Now I want to collect the coordinates of the shape that I have drawn. I realize it can be done with “callbacks”, but I am not sure how. Can someone please help?
fig1 = px.scatter(df, x = "xcoord", y = "ycoord")
fig1.update_traces(marker=dict(size=2))
fig2 = px.scatter(boundary_df, x="x", y="y")
fig2.update_traces(marker=dict(size=3,color="Red"))
fig3 = go.Figure(data=fig1.data+ fig2.data,
layout=go.Layout(width=500,height=500))
fig3.update_layout(
dragmode='drawrect',
newshape=dict(line_color='cyan'),
title_text='Drag to add annotations - use modebar to change drawing tool'
)
fig3.show(config={'modeBarButtonsToAdd':[
'reload',
'drawopenpath',
'eraseshape'
]})
My code with two dataframes.