I don’t know about drawing shapes in Plotly, but in the example, the
<Plot> component has to be rendered with the same data and layout that you provide to
If there’s anything that the user draws on the
<Plot> after it’s first rendered, that won’t be included in the data and layout that you initially used to render it.
In my case, I wanted to preserver the user’s changes to the
selected points on the
<Plot>, and also changes to the axes, so that I could pass those changes to the
I did this by responding to update and selection changes:
onSelected, I update the state of
layout so that I can pass these to
Plotly.plot('graph', data, layout).
I think you’ll need to figure out the same approach with drawing of shapes.