offsetgroup with horizontally stacked/relative bar traces
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
It appears the feature to allow offsetgroup to work with stacked/relative bar traces (https://github.com/plotly/plotly.js/pull/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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python reproduction in this issue and compare it with the linked Plotly documentation example and Plotly.js pull request #7009. Trace how horizontal, stacked bar traces handle offsetgroup; done means distinct horizontal offset groups render correctly for the provided example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100