-
Notifications
You must be signed in to change notification settings - Fork 3
feat: support subplots in py-maidr using maidr-ts #147
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
Conversation
Professor @jooyoungseo & @SaaiVenkat, Additionally, facet plots have not yet been tested. It's possible facet plots may require further adjustments or fixes. However, to facilitate prompt feedback and review, I'm submitting this PR now. Once facet plots have been tested, I'll either update this PR with the corresponding example or open a new PR if significant changes are required. Thank you, |
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 implements support for subplots in the maidr-ts rendering engine by restructuring the Maidr object to build a grid layout that supports multiple plot layers. Key changes include:
- Refactoring the _flatten_maidr method to organize plots into a grid with row and column indices.
- Updates to example scripts across seaborn, matplotlib, and multilayer examples to demonstrate the new subplot and multilayer capabilities.
- Minor modifications in related modules, such as API adjustments and patch updates for bar and scatter plots.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
example/multipanel/seaborn/example_sns_multipanel.py | New multipanel seaborn example script. |
example/multipanel/matplotlib/example_mpl_multipanel.py | New multipanel matplotlib example script with a typo fix. |
example/multilayer/example_mpl_multilayer.py | New multilayer example script demonstrating dual-axis plots. |
maidr/core/maidr.py | Updates to flatten Maidr layout for TS engine and minor import adjustments. |
maidr/patch/barplot.py | Adjustments to plotting behavior for bar charts. |
maidr/util/mixin/extractor_mixin.py | Updates to tick extraction logic for improved data handling. |
maidr/api.py | Enhancements to support multiple axes in the show and save_html functions. |
example/stacked/matplotlib/example_mpl_stacked.py | Updated labels and layout for stacked matplotlib example. |
maidr/core/plot/barplot.py | Fixes in data extraction logic for TS engine compatibility. |
maidr/core/plot/maidr_plot.py | Adding subplot indexing from the subplotspec for grid layouts. |
maidr/patch/scatterplot.py | Minor formatting cleanup. |
Comments suppressed due to low confidence (1)
maidr/patch/barplot.py:55
- [nitpick] The updated branch in the bar function removes the numeric type check for 'x' positions; if this change is not intentional, consider reinstating the check to correctly determine a dodged bar plot, or update the documentation to reflect the new behavior.
else:
Referencing an additional PR that adds supports for facet plots |
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.
LGTM!
@dakshpokar Please address the branch conflict and merge. |
Merging this! |
Description
This PR address the subplots feature that is supported in maidr-ts using (https://github.com/xability/maidr-ts/pull/130) by restructuring the Maidr Object in a proper structure way. This change implements grid layout support for the TypeScript rendering engine within the
_flatten_maidr
method. The implementation transforms plot schemas into a structured grid format where each cell can contain multiple plot layers. The code calculates maximum row and column dimensions, groups plots by position coordinates, arranges them into appropriate grid cells, and assigns unique IDs to each subplot. This structured approach enables complex multi-plot layouts in the TypeScript engine while maintaining proper spatial relationships between subplots. The result is a hierarchical JSON structure with an outer container ID and a nested grid of subplots, each containing their respective visualization layers.P.S.: This change will continue to support MaidrJS Engine.
Type of Change
Checklist