Skip to content

Add PNG/SVG export functionality for Bokeh plots (Issue #132) - #140

Open
jayhesselberth wants to merge 2 commits into
mainfrom
claude/code-review-011CUvW2qdGqBJcAmTG3KLWG
Open

Add PNG/SVG export functionality for Bokeh plots (Issue #132)#140
jayhesselberth wants to merge 2 commits into
mainfrom
claude/code-review-011CUvW2qdGqBJcAmTG3KLWG

Conversation

@jayhesselberth

Copy link
Copy Markdown
Member

Implement static image export with dimension control:

Python Backend:

  • Create squiggy/export.py with PNG/SVG export functions
  • Add export_plot_to_png() and export_plot_to_svg() for direct export
  • Add export_current_plot() wrapper for extension integration
  • Store last generated plot in global _last_plot_figure variable
  • Update all plotting functions to call set_current_plot()

TypeScript Extension:

  • Add squiggy.exportPlot command with export dialog UI
  • Prompt for format (PNG/SVG/HTML), dimensions, and DPI
  • Call Python export functions via PositronRuntime
  • Update SquigglePlotPanel with exportPlotWithPython() method

Features:

  • PNG export with configurable width, height, and DPI
  • SVG export with configurable width and height
  • HTML export (existing functionality, now integrated)
  • Interactive dialog for dimension control
  • Selenium auto-managed via Selenium Manager (>=4.6)

Dependencies:

  • Uses existing export optional dependency group in pyproject.toml
  • Requires pip install squiggy-positron[export] for PNG export
  • SVG export has no additional dependencies

User Experience:

  • Command palette: "Squiggy: Export Current Plot (PNG/SVG/HTML)"
  • Prompts for format selection
  • Prompts for dimensions (width, height)
  • Prompts for DPI (PNG only)
  • Shows save dialog with appropriate file extension
  • Displays success message with file path

Closes #132

claude and others added 2 commits November 8, 2025 13:34
Implement static image export with dimension control:

**Python Backend**:
- Create `squiggy/export.py` with PNG/SVG export functions
- Add `export_plot_to_png()` and `export_plot_to_svg()` for direct export
- Add `export_current_plot()` wrapper for extension integration
- Store last generated plot in global `_last_plot_figure` variable
- Update all plotting functions to call `set_current_plot()`

**TypeScript Extension**:
- Add `squiggy.exportPlot` command with export dialog UI
- Prompt for format (PNG/SVG/HTML), dimensions, and DPI
- Call Python export functions via PositronRuntime
- Update `SquigglePlotPanel` with `exportPlotWithPython()` method

**Features**:
- PNG export with configurable width, height, and DPI
- SVG export with configurable width and height
- HTML export (existing functionality, now integrated)
- Interactive dialog for dimension control
- Selenium auto-managed via Selenium Manager (>=4.6)

**Dependencies**:
- Uses existing `export` optional dependency group in pyproject.toml
- Requires `pip install squiggy-positron[export]` for PNG export
- SVG export has no additional dependencies

**User Experience**:
- Command palette: "Squiggy: Export Current Plot (PNG/SVG/HTML)"
- Prompts for format selection
- Prompts for dimensions (width, height)
- Prompts for DPI (PNG only)
- Shows save dialog with appropriate file extension
- Displays success message with file path

Closes #132
- Remove unused `io` import from squiggy/export.py
- Remove unused `svg_io` variable assignment
- Sort imports in squiggy/__init__.py
- Remove unused ExportOptions interface from plot-commands.ts
- Prefix unused parameters with _ in squiggy-plot-panel.ts

All tests pass and linting is clean.
lkwhite added a commit that referenced this pull request Nov 9, 2025
- Remove unused `io` import from squiggy/export.py
- Remove unused `svg_io` variable assignment
- Sort imports in squiggy/__init__.py
- Remove unused ExportOptions interface from plot-commands.ts
- Prefix unused parameters with _ in squiggy-plot-panel.ts

All tests pass and linting is clean.
@jayhesselberth
jayhesselberth force-pushed the claude/code-review-011CUvW2qdGqBJcAmTG3KLWG branch from 40acaa1 to 277d9ed Compare March 3, 2026 22:05
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.

Add static image export (PNG/SVG) with dimension control for Bokeh plots

3 participants