Simplifying MultiPlot Interface #83
feat(ChromatogramPlot): Add tile_by parameter for automated subplot creation
- Introduced the
tile_byparameter in ChromatogramPlot to split data into subplots automatically. - Eliminated the need for manual canvas specification by handling subplot creation internally.
- Added validation to ensure the
tile_bycolumn exists in both the chromatogram and annotation data. - Refactored code with a helper function to reduce duplication.
- Updated documentation and tests for the new functionality.
Summary by CodeRabbit
- New Features
- Enhanced plotting capabilities now automatically group and tile visualizations, offering improved clarity and a more organized layout.
- Expanded configuration options empower users to customize plot arrangements, including multi-run spectrum analysis with refined grid layouts.
- Refactor
- Simplified error handling and streamlined plotting logic enhance stability and performance.
Walkthrough
This pull request enhances plotting capabilities across multiple modules. Gallery scripts now automate subplot creation using a new facet_column parameter to group data, while the spectrum binning script supports multiple runs and a revised subplot layout. In internal modules, new configuration attributes (facet_column, facet_col_wrap) and validation logic have been added to support tiled layouts. Additionally, new methods in the Matplotlib plotting class manage subplot grid creation and axis cleanup. Minor updates include refined error handling, adjusted import statements, and small test file formatting changes.
Changes
| File(s) | Change Summary |
|---|---|
docs/gallery_scripts_template/plot_spyogenes_subplots_ms_matplotlib.pydocs/gallery_scripts_template/plot_investigate_spectrum_binning_ms_matplotlib.py |
Enhanced plotting logic to automate subplot creation using a facet_column, update subplot layouts (including a 4x2 grid for spectrum binning), and modify error and display handling. |
pyopenms_viz/_config.pypyopenms_viz/_core.py |
Added new attributes (facet_column, facet_col_wrap) to plotting configuration; restructured ChromatogramPlot.plot() with configuration validation and subplot grouping. |
pyopenms_viz/__init__.py |
Inserted a commented-out placeholder argument (tile_by) within the PlotAccessor class. |
pyopenms_viz/_matplotlib/core.py |
Introduced three new utility methods (_compute_y_range_and_padding, _create_subplots, _delete_extra_axes) for subplot management and set the Matplotlib backend to "Agg". |
test/conftest.pytest/test_spectrum.py |
Added extra imports and a commented-out dynamic path resolution line; adjusted formatting (e.g. insertion of a blank line). |
Sequence Diagram(s)
sequenceDiagram
participant U as User/Application
participant CP as ChromatogramPlot
participant DF as DataFrame
U->>CP: Call plot()
CP->>CP: _validate_plot_config()
alt Valid facet_column
CP->>DF: Group data by facet_column
DF-->>CP: Return grouped data
CP->>CP: Create subplots and prepare tooltips
else Invalid facet_column
CP->>CP: Fallback to single plot logic
end
CP-->>U: Display plot with subplots
Possibly related PRs
- OpenMS/pyopenms_viz#82: Modifies subplot management and plot display methods, aligning closely with these plotting enhancements.
- OpenMS/pyopenms_viz#57: Involves similar enhancements in plotting functionality by introducing grouping parameters.
- OpenMS/pyopenms_viz#39: Introduces the
facet_columnparameter, directly relating to the new subplot configuration methods.
Suggested reviewers
- jcharkow
Poem
I'm a rabbit, hopping through code with glee,
Plotting data in subplots as neat as can be.
Facets and grids now dance in a row,
Each run and axis in a neat, tiled show.
I nibble through changes, swift and bright,
Celebrating each line from morning till night.
Carrots and code—what a delightful sight!
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai planto trigger planning for file edits and PR creation.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Hi @jcharkow I have solved most of the conflicts if you want you can review it.
Hi @jcharkow I have solved most of the conflicts if you want you can review it.
I'll wait untill all the conflicts are solved and then I'll review