Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Updating the plot data and saving it

Hi there,

I am working on an app that can make edits to a plot. Right now, when the user chooses to update the plotly’s hover text, I am retracing the plot. When I leave the chart, the traces return back to the original state.

Is there a way I can save this plot with the new traces?

Thanks in advance.

Hello,

This is something that may work.

DataOut=[]
for i in range(4): 
    trace= go.Scatter(
            x=...,
            y=..., 
            name=...,
            )
    DataOut.append(trace)

#input the new trace as 'trace'
DataOut.append(trace)
updatemenus = list([dict(active=0, buttons=list([
                            dict(label = 'Edit Number '+str(k),
                                method = 'update',
                                args = [{'visible':[True if j==len(DataOut) else False for j in range(len(DataOut))]},
                                        {'title': ('Loan Satus Vs '+feat[k])}]

                         ) for k in range(n)]
#n is the number of plots in total. in this case n=5
                         ),)
    ])

layout.updatemenus= updatemenus

This should show you all the versions of the graph after each change as a dropdown.