Skip to content

update: handle plotting in pyodide - #296

Merged
VsevolodX merged 1 commit into
mainfrom
feature/SOF-7887
Apr 15, 2026
Merged

update: handle plotting in pyodide#296
VsevolodX merged 1 commit into
mainfrom
feature/SOF-7887

Conversation

@VsevolodX

@VsevolodX VsevolodX commented Apr 14, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Refactor
    • Improved plot rendering consistency by consolidating visualization display logic across scatter plots, RDF distributions, and series plots through a unified rendering system, ensuring better compatibility and reliability across different notebook environments.

@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c801187-c2c9-47b2-a3ce-689f8110fe8d

📥 Commits

Reviewing files that changed from the base of the PR and between d090615 and 9818f3a.

📒 Files selected for processing (1)
  • utils/plot.py

📝 Walkthrough

Walkthrough

Consolidated plotting display logic in utils/plot.py by replacing direct Matplotlib and IPython display calls with a centralized render_figure() function. Removed Pyodide-specific backend handling from plot_rdf and updated multiple plotting functions to standardize their display approach.

Changes

Cohort / File(s) Summary
Plot Display Consolidation
utils/plot.py
Refactored four plotting functions (plot_strain_vs_area, plot_twisted_interface_solutions, plot_rdf, plot_series) to use centralized render_figure() instead of direct fig.show() and IPython display calls. Removed Pyodide-specific matplotlib backend switching and buffer-based PNG rendering from plot_rdf. Updated imports to include render_figure and removed io, sys, and IPython.display.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Fix/rdf plot (SOF-7807) #264 — Also modifies utils/plot.py plotting/display logic and Pyodide handling but implements opposing approaches to the current changes.

Suggested reviewers

  • timurbazhirov

Poem

🐰 The plots once showed in tangled ways,
With Pyodide quirks and display delays,
Now render_figure keeps things neat,
One function makes the cleanup complete! 🎨✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main change: refactoring plot functions to use a unified render_figure() handler instead of direct display calls, which enables proper Pyodide support.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/SOF-7887

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@VsevolodX
VsevolodX merged commit 9cfa8aa into main Apr 15, 2026
5 checks passed
@VsevolodX
VsevolodX deleted the feature/SOF-7887 branch April 15, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants