Hello!
I wrote simple code, but it seems it doesn’t work properly. When I click on the button, only the first one subplot is updated.
If I try to change any other atributes of subplots (such as x or y axis values) it works correct.
Am I doing something wrong, or is there any workaround you can suggest to help me, fix this? Any help is highly appreciated.
Update: Also when I try to download plot using “download plot as a png” error is occuring (shown on the last image)
import ipywidgets as widgets
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')
subplot.add_bar(x=[1,2,3], y=['a', 'b', 'c'], row=1, col=3, name='3', orientation='v')
def change_orientation(obj):
if obj.new == True:
for item in fig_widg.data:
item.orientation = 'h'
else:
for item in fig_widg.data:
item.orientation = 'v'
is_horizontal = widgets.Checkbox(description='Horizontal')
is_horizontal.observe(change_orientation, 'value')
fig_widg = go.FigureWidget(subplot)
box = widgets.VBox([is_horizontal, fig_widg])
box