Open
Description
It appears the feature to allow offsetgroup to work with stacked/relative bar traces (plotly/plotly.js#7009) does not work with horizontally oriented bar traces. Taking the example from the documentation
https://plotly.com/python/bar-charts/#grouped-stacked-bar-chart
if I reverse the x and y axis and set orientation to 'h', the traces are not separated by the different offset groups:
import plotly.graph_objects as go
data = [
go.Bar(
y=['Q1', 'Q2', 'Q3', 'Q4'],
x=[150, 200, 250, 300],
name='New York',
offsetgroup="USA",
orientation='h'
),
go.Bar(
y=['Q1', 'Q2', 'Q3', 'Q4'],
x=[180, 220, 270, 320],
name='Boston',
offsetgroup="USA",
orientation='h'
),
go.Bar(
y=['Q1', 'Q2', 'Q3', 'Q4'],
x=[130, 170, 210, 260],
name='Montreal',
offsetgroup="Canada",
orientation='h'
),
go.Bar(
y=['Q1', 'Q2', 'Q3', 'Q4'],
x=[160, 210, 260, 310],
name='Toronto',
offsetgroup="Canada",
orientation='h'
)
]
layout = go.Layout(
title={
'text': 'Quarterly Sales by City, Grouped by Country'
},
yaxis={
'title': {
'text': 'Quarter'
}
},
xaxis={
'title': {
'text': 'Sales'
}
},
barmode='stack'
)
fig = go.Figure(data=data, layout=layout)
fig.show()
Using plotly 6.0.0.