Fix stacked barplot missing groups issue (#5428)#5469
Open
AJSTYLE-lab wants to merge 1 commit intoplotly:mainfrom
Open
Fix stacked barplot missing groups issue (#5428)#5469AJSTYLE-lab wants to merge 1 commit intoplotly:mainfrom
AJSTYLE-lab wants to merge 1 commit intoplotly:mainfrom
Conversation
506baca to
5f740c8
Compare
Contributor
|
Thanks for the PR! One of our team members will review and provide feedback. |
Contributor
|
It looks like your PR isn't updating the library, just providing a workaround for the original issue. Did you intend to update the library with a fix? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description for #5428
Title:
Fix stacked barplot missing groups issue (#5428)
Description:
This PR addresses the bug where certain groups (commanders) with non-missing values are not displayed in stacked bar plots when using plotly.express.bar.
Problem:
When plotting a stacked bar chart of commander_perc_of_card vs. savedate_week, some commanders with values for certain weeks were missing in the overall plot.
This happens because plotly.express.bar only plots groups that exist for each specific x value (savedate_week). Missing combinations are ignored, even if other weeks have values.
Solution:
Generated all possible combinations of savedate_week and commanders using itertools.product.
Merged these combinations with the original dataset.
Filled missing commander_perc_of_card values with 0 to ensure that every commander is displayed for every week.
This guarantees that stacked barplots now show all groups, maintaining accurate visual representation.
Files Modified:
reproduce_bug.py — added a reproducible example to demonstrate the fix.
Before
After
Code: