When running the code below, the gridline between items of the first level of the y-axis has strange behavior. The divider extends only to a certain part of the graph, leaving the rest of the graph without any dividers between the items.
Any ideas on how to fix this?
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# MultiIndex
ylabels = [
['Group 1', 'Group 1', 'Group 2', 'Group 2'],
['Subgroup A', 'Subgroup B', 'Subgroup A', 'Subgroup B']
]
# Create subplots with a shared y-axis
fig = make_subplots(rows=1, cols=3, shared_yaxes=True)
# First subplot
fig.add_trace(go.Bar(y=ylabels, x=[5, 15, 25, 35], orientation='h'), row=1, col=1)
fig.add_trace(go.Bar(y=ylabels, x=[1, 2, 3, 4], orientation='h'), row=1, col=1)
# Second subplot
fig.add_trace(go.Bar(y=ylabels, x=[45, 55, 65, 75], orientation='h'), row=1, col=2)
fig.add_trace(go.Bar(y=ylabels, x=[5, 6, 7, 8], orientation='h'), row=1, col=2)
# Third subplot
fig.add_trace(go.Bar(y=ylabels, x=[85, 95, 105, 115], orientation='h'), row=1, col=3)
fig.add_trace(go.Bar(y=ylabels, x=[9, 10, 11, 12], orientation='h'), row=1, col=3)
# Update layout properties
fig.update_layout(title='Subplots with Shared Y-Axis and MultiIndex Data', showlegend = False)
# Show the plot
fig
