I'd like to draw interactive plot and dropdown winget. For this aim I use the following code in my jupyter notebook:
import ipywidgets as widgets
import plotly.graph_objects as go
import pandas as pd
df = pd.DataFrame({'timestamp' : [1,2,3,4,5,6], 'close' : [11,22,33,44,55,66], 'open' : [111,222,333,444,555,666]})
def plot(feature):
fig = go.Figure(data=go.Scatter(x = df['timestamp'].values, y = df[feature].values),
layout_title_text = feature
)
fig.show()
_ = widgets.interact(plot, feature = ['close', 'open'])
Every time when I select value in dropdown box the corresponding plot is displayed in separate output - but I'd like to update existing:
PLease explain how to fix this issue