✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
📊 Dash 2.0 is Arriving. Register here.

Updating subplots from ipywidgets

I am trying to update a plot in subplot by using ipywidgets button click. But it is not working. Here is my code

import ipywidgets as widgets
import plotly.graph_objects as go
from plotly.subplots import make_subplots

subplot = make_subplots(rows=1, cols=3)
subplot.add_bar(x=[1,2,3], y=[‘a’, ‘b’, ‘c’], row=1, col=1, name=‘1’, orientation=‘v’)
subplot.add_bar(x=[1,2,3], y=[‘a’, ‘b’, ‘c’], row=1, col=2, name=‘2’, orientation=‘v’)

def click_action(obj):
subplot.add_bar(x=[1,2,3], y=[‘a’, ‘b’, ‘c’], row=1, col=3, name=‘3’, orientation=‘v’)

add_plot = widgets.Button(description = ‘add plot’)

fig_widg = go.FigureWidget(subplot)
box = widgets.VBox([add_plot, fig_widg])