-
Couldn't load subscription status.
- Fork 6
fix: handle horizontal vs vertical bar plot orientation in subplot iteration #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…eration Co-authored-by: jooyoungseo <[email protected]>
7e80e35 to
c81c34a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a critical bug where maidr.show() would fail with a TypeError: 'NoneType' object is not iterable when used with horizontal bar plots. The issue stemmed from incorrect axis label extraction logic that didn't account for plot orientation differences.
Key changes:
- Added orientation-aware axis selection for extracting category labels (Y-axis for horizontal bars, X-axis for vertical bars)
- Updated value extraction to use appropriate dimension based on orientation (width for horizontal, height for vertical)
- Enhanced error handling with null checks and fallback label generation
| """ | ||
| Extract plot data for bar plots. | ||
| For vertical bar plots, categories are on X-axis and values on Y-axis. | ||
| For horizontal bar plots, categories are on Y-axis and values on X-axis. | ||
| Returns | ||
| ------- | ||
| list | ||
| List of dictionaries containing x and y data points. | ||
| """ |
Copilot
AI
Sep 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring follows a good structure but is missing the Parameters section. According to PEP 257 and NumPy style guidelines, even if a method has no parameters, it's better to be explicit about this in the docstring format for consistency.
| """ | ||
| Extract bar container data with proper orientation handling. | ||
| Parameters | ||
| ---------- | ||
| plot : list[BarContainer] | None | ||
| List of bar containers from the plot. | ||
| Returns | ||
| ------- | ||
| list | None | ||
| List of bar heights/widths, or None if extraction fails. | ||
| """ |
Copilot
AI
Sep 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring is well-structured and follows NumPy style guidelines. However, it would benefit from adding an example section showing how to use this method, especially given the complexity of handling different orientations.
|
@copilot Address review comments. |
Co-authored-by: jooyoungseo <[email protected]>
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.