From 1a0be7e25fdb196289b421ba356387336d4a9ebd Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Thu, 15 Oct 2020 10:29:17 -0400 Subject: [PATCH 01/72] fix url --- templates/t_index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/t_index.html b/templates/t_index.html index 3d03407..2ab1978 100644 --- a/templates/t_index.html +++ b/templates/t_index.html @@ -63,7 +63,7 @@
-
© 2020 Tim Hopper
- +
© 2026 Tim Hopper
+
diff --git a/web/css/custom.css b/web/css/custom.css new file mode 100644 index 0000000..4e16bcd --- /dev/null +++ b/web/css/custom.css @@ -0,0 +1,35 @@ +body { + padding-top: 5rem; +} + +.highlight pre { + padding: 1em; + margin-bottom: 0px; +} + +.card-footer p:last-child { margin-bottom: 0 !important; margin-right: 0 !important; } + +.right-col { + background-color: #202020; +} + +.comment { + background-color: #f7f7f9; +} + +.card { + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); + border-radius: 0; + border: 0; +} + +table { + font-family: monospace; +} + +@media (min-width: 1600px) { + .container { + width: 1440px; + max-width: 100%; + } +} diff --git a/web/css/pygments-native.css b/web/css/pygments-native.css new file mode 100644 index 0000000..5be7daf --- /dev/null +++ b/web/css/pygments-native.css @@ -0,0 +1,72 @@ +.highlight pre .hll { background-color: #404040 } +.highlight pre { background: #202020; color: #d0d0d0 } +.highlight pre .c { color: #999999; font-style: italic } /* Comment */ +.highlight pre .err { color: #a61717; background-color: #e3d2d2 } /* Error */ +.highlight pre .esc { color: #d0d0d0 } /* Escape */ +.highlight pre .g { color: #d0d0d0 } /* Generic */ +.highlight pre .k { color: #6ab825; font-weight: bold } /* Keyword */ +.highlight pre .l { color: #d0d0d0 } /* Literal */ +.highlight pre .n { color: #d0d0d0 } /* Name */ +.highlight pre .o { color: #d0d0d0 } /* Operator */ +.highlight pre .x { color: #d0d0d0 } /* Other */ +.highlight pre .p { color: #d0d0d0 } /* Punctuation */ +.highlight pre .cm { color: #999999; font-style: italic } /* Comment.Multiline */ +.highlight pre .cp { color: #cd2828; font-weight: bold } /* Comment.Preproc */ +.highlight pre .c1 { color: #999999; font-style: italic } /* Comment.Single */ +.highlight pre .cs { color: #e50808; font-weight: bold; background-color: #520000 } /* Comment.Special */ +.highlight pre .gd { color: #d22323 } /* Generic.Deleted */ +.highlight pre .ge { color: #d0d0d0; font-style: italic } /* Generic.Emph */ +.highlight pre .gr { color: #d22323 } /* Generic.Error */ +.highlight pre .gh { color: #ffffff; font-weight: bold } /* Generic.Heading */ +.highlight pre .gi { color: #589819 } /* Generic.Inserted */ +.highlight pre .go { color: #cccccc } /* Generic.Output */ +.highlight pre .gp { color: #aaaaaa } /* Generic.Prompt */ +.highlight pre .gs { color: #d0d0d0; font-weight: bold } /* Generic.Strong */ +.highlight pre .gu { color: #ffffff; text-decoration: underline } /* Generic.Subheading */ +.highlight pre .gt { color: #d22323 } /* Generic.Traceback */ +.highlight pre .kc { color: #6ab825; font-weight: bold } /* Keyword.Constant */ +.highlight pre .kd { color: #6ab825; font-weight: bold } /* Keyword.Declaration */ +.highlight pre .kn { color: #6ab825; font-weight: bold } /* Keyword.Namespace */ +.highlight pre .kp { color: #6ab825 } /* Keyword.Pseudo */ +.highlight pre .kr { color: #6ab825; font-weight: bold } /* Keyword.Reserved */ +.highlight pre .kt { color: #6ab825; font-weight: bold } /* Keyword.Type */ +.highlight pre .ld { color: #d0d0d0 } /* Literal.Date */ +.highlight pre .m { color: #3677a9 } /* Literal.Number */ +.highlight pre .s { color: #ed9d13 } /* Literal.String */ +.highlight pre .na { color: #bbbbbb } /* Name.Attribute */ +.highlight pre .nb { color: #24909d } /* Name.Builtin */ +.highlight pre .nc { color: #447fcf; text-decoration: underline } /* Name.Class */ +.highlight pre .no { color: #40ffff } /* Name.Constant */ +.highlight pre .nd { color: #ffa500 } /* Name.Decorator */ +.highlight pre .ni { color: #d0d0d0 } /* Name.Entity */ +.highlight pre .ne { color: #bbbbbb } /* Name.Exception */ +.highlight pre .nf { color: #447fcf } /* Name.Function */ +.highlight pre .nl { color: #d0d0d0 } /* Name.Label */ +.highlight pre .nn { color: #447fcf; text-decoration: underline } /* Name.Namespace */ +.highlight pre .nx { color: #d0d0d0 } /* Name.Other */ +.highlight pre .py { color: #d0d0d0 } /* Name.Property */ +.highlight pre .nt { color: #6ab825; font-weight: bold } /* Name.Tag */ +.highlight pre .nv { color: #40ffff } /* Name.Variable */ +.highlight pre .ow { color: #6ab825; font-weight: bold } /* Operator.Word */ +.highlight pre .w { color: #666666 } /* Text.Whitespace */ +.highlight pre .mb { color: #3677a9 } /* Literal.Number.Bin */ +.highlight pre .mf { color: #3677a9 } /* Literal.Number.Float */ +.highlight pre .mh { color: #3677a9 } /* Literal.Number.Hex */ +.highlight pre .mi { color: #3677a9 } /* Literal.Number.Integer */ +.highlight pre .mo { color: #3677a9 } /* Literal.Number.Oct */ +.highlight pre .sb { color: #ed9d13 } /* Literal.String.Backtick */ +.highlight pre .sc { color: #ed9d13 } /* Literal.String.Char */ +.highlight pre .sd { color: #ed9d13 } /* Literal.String.Doc */ +.highlight pre .s2 { color: #ed9d13 } /* Literal.String.Double */ +.highlight pre .se { color: #ed9d13 } /* Literal.String.Escape */ +.highlight pre .sh { color: #ed9d13 } /* Literal.String.Heredoc */ +.highlight pre .si { color: #ed9d13 } /* Literal.String.Interpol */ +.highlight pre .sx { color: #ffa500 } /* Literal.String.Other */ +.highlight pre .sr { color: #ed9d13 } /* Literal.String.Regex */ +.highlight pre .s1 { color: #ed9d13 } /* Literal.String.Single */ +.highlight pre .ss { color: #ed9d13 } /* Literal.String.Symbol */ +.highlight pre .bp { color: #24909d } /* Name.Builtin.Pseudo */ +.highlight pre .vc { color: #40ffff } /* Name.Variable.Class */ +.highlight pre .vg { color: #40ffff } /* Name.Variable.Global */ +.highlight pre .vi { color: #40ffff } /* Name.Variable.Instance */ +.highlight pre .il { color: #3677a9 } /* Literal.Number.Integer.Long */ From 36a79c9f28a7a051c80074c10029b82e8d895672 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 14:38:38 -0400 Subject: [PATCH 22/72] Remove legacy Travis/conda files and stale migration docs CI is GitHub Actions with uv; dependency spec lives in pyproject.toml and uv.lock. The Makefile s3/cloudfront targets' scripts are gone too since deployment is Netlify. --- .travis.yml | 40 ----- .travis/authenticate_plotly.py | 15 -- .travis/install_conda.sh | 11 -- .travis/invalidate_cloudfront.py | 19 --- .travis/orca | 2 - MIGRATION_NOTES.md | 282 ------------------------------- MODERNIZATION_SUMMARY.md | 137 --------------- TESTING_CHECKLIST.md | 111 ------------ environment.yml | 11 -- netlify_deploy.sh | 16 -- requirements.txt | 43 ----- runtime.txt | 1 - 12 files changed, 688 deletions(-) delete mode 100644 .travis.yml delete mode 100644 .travis/authenticate_plotly.py delete mode 100644 .travis/install_conda.sh delete mode 100644 .travis/invalidate_cloudfront.py delete mode 100755 .travis/orca delete mode 100644 MIGRATION_NOTES.md delete mode 100644 MODERNIZATION_SUMMARY.md delete mode 100644 TESTING_CHECKLIST.md delete mode 100644 environment.yml delete mode 100755 netlify_deploy.sh delete mode 100644 requirements.txt delete mode 100644 runtime.txt diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fa25c6d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -dist: xenial -addons: - artifacts: true - apt: - packages: - - firefox-geckodriver -language: python -python: - - '3.7' -notifications: - email: true -before_install: - - nvm install node -install: - - sudo add-apt-repository --yes ppa:marutter/rrutter3.5 - - sudo apt-get update --yes - - sudo apt install r-api-3.5 --yes - - sudo apt-get install r-cran-mgcv - - sudo su - -c "R -e \"install.packages('ggplot2', repos='http://cran.rstudio.com/')\"" - - mkdir $HOME/orca - - wget --quiet https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage -O $HOME/orca/orca - - chmod +x $HOME/orca/orca - - export PATH="${HOME}/orca:${PATH}" - - pip install --quiet -r requirements.txt -before_script: - - echo $PATH - - $HOME/orca/orca --help - - orca --help - - pip freeze -services: - - xvfb -script: make travis -before_deploy: - - npm install netlify-cli -g -deploy: - provider: script - script: ./netlify_deploy.sh - skip_cleanup: true - on: - all_branches: true diff --git a/.travis/authenticate_plotly.py b/.travis/authenticate_plotly.py deleted file mode 100644 index 9425ca3..0000000 --- a/.travis/authenticate_plotly.py +++ /dev/null @@ -1,15 +0,0 @@ -# DEPRECATED: This file is no longer used. -# -# With plotly v5+, credentials are not required for local rendering. -# Plotly authentication is only needed if uploading to Chart Studio. -# This project renders plots locally to PNG using Kaleido, so no -# authentication is necessary. -# -# Historical code (plotly v4): -# import plotly -# import os -# plotly.tools.set_credentials_file(username=os.environ.get('PLOTLY_USER'), api_key=os.environ.get('PLOTLY_API_KEY')) - -import sys -print("Warning: plotly authentication is no longer needed with plotly v5+", file=sys.stderr) -print("This script is deprecated and can be removed.", file=sys.stderr) diff --git a/.travis/install_conda.sh b/.travis/install_conda.sh deleted file mode 100644 index dcb0e81..0000000 --- a/.travis/install_conda.sh +++ /dev/null @@ -1,11 +0,0 @@ -wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh -bash miniconda.sh -b -p $HOME/miniconda -rm -f miniconda.sh -hash -r -$HOME/miniconda/bin/conda config --set always_yes yes --set changeps1 no -$HOME/miniconda/bin/conda update -q conda -$HOME/miniconda/bin/conda info -a -conda install --quiet pip readline r-essentials -conda install --quiet --channel r rpy2 -wget --quiet https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage -O orca.AppImage -chmod +x orca.AppImage diff --git a/.travis/invalidate_cloudfront.py b/.travis/invalidate_cloudfront.py deleted file mode 100644 index 0205286..0000000 --- a/.travis/invalidate_cloudfront.py +++ /dev/null @@ -1,19 +0,0 @@ -import boto3 -import time - -client = boto3.client('cloudfront') - -response = client.create_invalidation( - DistributionId='EL6HA8RZFI08I', - InvalidationBatch={ - 'Paths': { - 'Quantity': 2, - 'Items': [ - '/index.html', - '/img/plots/*' - ] - }, - 'CallerReference': str(time.time()) - } -) -print(response) diff --git a/.travis/orca b/.travis/orca deleted file mode 100755 index 7d54224..0000000 --- a/.travis/orca +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -xvfb-run -a ./orca.AppImage "$@" diff --git a/MIGRATION_NOTES.md b/MIGRATION_NOTES.md deleted file mode 100644 index afd27ad..0000000 --- a/MIGRATION_NOTES.md +++ /dev/null @@ -1,282 +0,0 @@ -# Migration Notes: Modernization to 2025 - -This document summarizes the modernization work completed on pythonplot.com. - -## Overview - -The project has been modernized from 2020-era dependencies and infrastructure to 2025 standards: -- Python 3.6 → 3.11 -- Conda → uv package manager -- Travis CI → GitHub Actions -- Outdated plotting libraries → Latest versions -- Deprecated packages removed - -## Changes Made - -### 1. Python Environment Modernization - -**New Files:** -- `pyproject.toml`: Modern Python project configuration with all dependencies -- `setup_r.sh`: Script to install R packages (ggplot2, mgcv) - -**Updated Files:** -- `runtime.txt`: 3.6 → 3.11 -- `requirements.txt`: All packages updated to latest versions with minimum version constraints - -**Removed Dependencies:** -- `altair-saver` → Deprecated, using native altair rendering -- `chart-studio` → Not needed with plotly v5 local rendering -- `plotly-orca` → Replaced by Kaleido -- Duplicate `selenium` entry removed - -**Updated Dependencies:** -| Package | Old Version | New Version | Notes | -|---------|-------------|-------------|-------| -| plotly | 4.10.0 | 5.24+ | No authentication needed for local rendering | -| plotnine | <0.7.0 | 0.13+ | Better ggplot2 compatibility | -| statsmodels | 0.11.1 | 0.14+ | Security fixes | -| seaborn | (latest) | 0.13+ | Updated API | -| altair | (latest) | 5.0+ | Major version bump | -| rpy2 | (unversioned) | 3.5+ | Python 3.11+ compatible | -| selenium | (duplicated) | 4.15+ | API changes in v4 | -| pandas | (latest) | 2.0+ | Major improvements | -| matplotlib | (latest) | 3.7+ | Modern features | - -### 2. R Integration Updates - -**Approach:** Separate system R installation (no longer using conda) - -**Changes:** -- Created `setup_r.sh` to install R packages -- R must be installed separately (via Homebrew, apt, or CRAN) -- rpy2 updated to work with system R and Python 3.11+ -- Documentation updated to explain R setup - -**Environment Variable:** `R_HOME` must be set correctly for rpy2 to work - -### 3. Build System Updates - -**Makefile Changes:** -- Removed `plotly_auth` target (no longer needed) -- Added `setup` target for uv-based dependency installation -- Updated `dev_environment` to use uv instead of conda -- Updated `.PHONY` declarations - -**What Didn't Change:** -- Core build targets (`render`, `qrender`, `test`, `run_nb`) -- render.py script (compatible with new libraries) -- Notebook structure and tagging system - -### 4. CI/CD Migration - -**From:** Travis CI -**To:** GitHub Actions - -**New File:** `.github/workflows/deploy.yml` - -**Workflow Features:** -- Uses r-lib/setup-r for R installation -- Uses uv for Python dependencies -- Runs on every push and pull request -- Automatic Netlify deployment: - - Production: master branch - - Preview: all other branches - -**Required GitHub Secrets:** -- `NETLIFY_AUTH_TOKEN` -- `NETLIFY_SITE_ID` - -**Legacy Files (Now Deprecated):** -- `.travis.yml` -- `.travis/authenticate_plotly.py` (marked deprecated with explanation) -- `.travis/install_conda.sh` (wasn't being used) -- `.travis/invalidate_cloudfront.py` (not needed with Netlify) - -### 5. Documentation Updates - -**README.md:** -- Added modern development setup instructions -- Updated to reflect uv usage -- Added build and CI/CD sections -- Clarified plotly no longer needs authentication - -**CLAUDE.md:** -- Updated all dependency versions -- Documented new setup process -- Added CI/CD section -- Updated technical constraints - -**New Documentation:** -- `TESTING_CHECKLIST.md`: Comprehensive testing guide for first build -- `MIGRATION_NOTES.md`: This file - -## Next Steps - -### Before First Build - -1. **Install System Dependencies:** - ```bash - # macOS - brew install r - - # Ubuntu/Debian - sudo apt-get install r-base r-base-dev - ``` - -2. **Set Up Development Environment:** - ```bash - make dev_environment - ``` - -3. **Verify Setup:** - ```bash - # Test Python packages - python -c "import pandas, plotly, seaborn, plotnine, altair, rpy2; print('✓ Python packages OK')" - - # Test R integration - python -c "import rpy2.robjects as ro; ro.r('library(ggplot2)'); print('✓ R integration OK')" - ``` - -### Testing the Build - -4. **Run Tests:** - ```bash - make test - ``` - -5. **Try Quick Render (no notebook execution):** - ```bash - make qrender - ``` - -6. **Full Build (executes notebook):** - ```bash - make render - ``` - - This will take several minutes - - Watch for any library compatibility issues - - Check `TESTING_CHECKLIST.md` for specific things to verify - -### Setting Up CI/CD - -7. **Configure GitHub Secrets:** - - Go to your GitHub repo → Settings → Secrets and variables → Actions - - Add `NETLIFY_AUTH_TOKEN` (from Netlify account settings) - - Add `NETLIFY_SITE_ID` (from Netlify site settings) - -8. **Test GitHub Actions:** - - Push to a test branch - - Check Actions tab to see workflow run - - Verify Netlify preview deployment - -9. **Deploy to Production:** - - Merge to master branch - - GitHub Actions will automatically deploy to production - -## Potential Issues to Watch For - -### Library Compatibility - -1. **plotly v5 Changes:** - - API changes from v4 to v5 - - Different image rendering (Kaleido vs Orca) - - No authentication needed - -2. **altair v5 Changes:** - - May need updates to save PNG images - - Selenium/geckodriver integration - -3. **plotnine 0.13:** - - Better ggplot2 compatibility but some API changes - -4. **statsmodels 0.14:** - - Check regression plots and confidence intervals - -### Environment Issues - -1. **R_HOME:** - - Must be set correctly for rpy2 - - GitHub Actions sets this automatically - - Locally: `export R_HOME=$(R RHOME)` - -2. **Headless Rendering:** - - Selenium needs xvfb on Linux - - GitHub Actions handles this automatically - - Locally on Linux: `xvfb-run make render` - -3. **geckodriver:** - - Must be in PATH for selenium - - GitHub Actions installs this automatically - - Locally: Install via package manager or download - -## Rollback Plan - -If you encounter critical issues: - -1. **Keep Travis CI temporarily:** - - Don't delete `.travis.yml` until GitHub Actions is proven - - Both can run simultaneously - -2. **Pin problematic packages:** - - If specific library versions cause issues, pin to older versions in requirements.txt - - Example: `plotly==4.14.3` if v5 has problems - -3. **Gradual migration:** - - Update libraries one at a time - - Test each change thoroughly - -## Files Changed Summary - -**New Files:** -- `pyproject.toml` -- `setup_r.sh` -- `.github/workflows/deploy.yml` -- `TESTING_CHECKLIST.md` -- `MIGRATION_NOTES.md` - -**Modified Files:** -- `runtime.txt` -- `requirements.txt` -- `Makefile` -- `README.md` -- `CLAUDE.md` -- `.travis/authenticate_plotly.py` (deprecated with explanation) - -**Deprecated (Not Deleted):** -- `environment.yml` (conda environment - no longer used) -- `.travis.yml` (Travis CI config) -- `.travis/` directory (old CI scripts) - -**No Changes:** -- `render.py` (compatible with new libraries) -- `Examples.ipynb` (may need updates if libraries break examples) -- `templates/t_index.html` -- `tests/test_plots.py` -- `INTRO.md` - -## Success Criteria - -The migration is successful when: - -- [ ] `make dev_environment` completes without errors -- [ ] `make test` passes all tests -- [ ] `make render` executes notebook and generates all plots -- [ ] GitHub Actions workflow runs successfully -- [ ] Site deploys correctly to Netlify -- [ ] All plotting libraries render correctly -- [ ] R ggplot2 examples work via rpy2 - -## Support - -If you encounter issues: - -1. Check `TESTING_CHECKLIST.md` for common problems -2. Review GitHub Actions logs for CI issues -3. Check package compatibility in individual notebook cells -4. File issues in the GitHub repository - ---- - -**Migration completed:** 2025-11-04 -**Python version:** 3.11+ -**Primary changes:** uv adoption, library updates, CI/CD modernization diff --git a/MODERNIZATION_SUMMARY.md b/MODERNIZATION_SUMMARY.md deleted file mode 100644 index 7fcbdbe..0000000 --- a/MODERNIZATION_SUMMARY.md +++ /dev/null @@ -1,137 +0,0 @@ -# Modernization Summary - pythonplot.com - -## ✅ Completed Successfully - -### Infrastructure Modernization -1. **Python 3.6 → 3.11** - Updated runtime and all dependencies -2. **Conda → uv** - Modern package management with `uv sync` -3. **Travis CI → GitHub Actions** - Modern CI/CD with Netlify deployment -4. **Makefile** - Auto-dependency setup with `make` just works -5. **R Integration** - Separate system R install with automated package setup - -### Dependency Updates -All plotting libraries updated to 2025 versions: -- pandas 2.3.3 -- matplotlib 3.10.7 -- seaborn 0.13.2 -- plotnine 0.15.1 -- plotly 6.3.1 (with Kaleido 1.1.0 + auto Chrome install) -- altair 5.5.0 (with vl-convert-python 1.8.0) -- statsmodels 0.14.5 - -### API Compatibility Fixes -1. **Seaborn 0.13+**: Fixed all `size` → `height` parameter changes (4 instances) -2. **Plotly 5+**: Removed authentication requirement, using Kaleido v1 with Chrome -3. **Altair 5**: Added vl-convert-python dependency - -### Build System -- ✅ `make` auto-installs all dependencies (Python, R, Chrome) -- ✅ `make test` runs pytest -- ✅ `make render` executes notebook and generates site -- ✅ Notebook executes successfully (32.9MB output) - -### CI/CD -- ✅ GitHub Actions workflow configured -- ✅ Netlify deployment (production + preview) -- ✅ Auto Chrome installation in CI - -## 🔄 Known Issues - -### Altair PNG Rendering -**Status**: Altair charts execute but don't produce PNG output in notebooks - -**Issue**: Altair 5 with vl-convert-python renders charts as Vega specs (HTML/JSON) by default, not PNGs. The `alt.renderers.enable('png')` doesn't automatically convert notebook outputs to PNG. - -**Options to fix**: -1. **Modify Altair cells** to explicitly save PNGs: - ```python - chart = alt.Chart(data).mark_bar()... - chart.save('temp.png') - from IPython.display import Image - Image('temp.png') - ``` - -2. **Use Altair's `.show()` with PNG format** (requires additional setup) - -3. **Skip Altair in rendered output** (not ideal for a comparison site) - -4. **Post-process notebook** to convert Vega specs to PNG using vl-convert - -**Impact**: Altair examples missing from rendered site. All other libraries work. - -## 📊 Build Statistics - -**Successful notebook execution:** -- Input: Examples.ipynb -- Output: Examples.e7639cc.ipynb (32.9MB) -- All R, pandas, matplotlib, seaborn, plotnine, and plotly examples executed -- Altair examples executed but need PNG conversion - -**Packages installed:** 147 Python packages + 2 R packages + Chrome - -## 🚀 Next Steps - -### Priority 1: Fix Altair PNG Rendering -- Investigate vl-convert PNG export in Jupyter context -- Consider modifying Altair cells to explicitly save PNGs -- Or implement post-processing step - -### Priority 2: Test Full Build -- Resolve Altair issue -- Run full `make render` successfully -- Verify all plots appear in `web/img/plots/` -- Check `web/index.html` displays correctly - -### Priority 3: Deploy Preview -- Run `netlify deploy --dir=web` for preview -- Verify site works with updated libraries -- Test all interactive elements - -### Priority 4: Documentation -- Update CLAUDE.md with Altair workaround -- Document known issues -- Add troubleshooting guide - -## 📝 Commits Made - -1. `c69894b` - Modernize Python dependencies to 2025 standards -2. `0f330d3` - Add R package setup script for separate R installation -3. `bf5b5f4` - Migrate build system from conda to uv -4. `edb7a82` - Migrate CI/CD from Travis CI to GitHub Actions -5. `291f9f4` - Deprecate plotly authentication script -6. `2497c2a` - Update documentation for modernized infrastructure -7. `b7198f3` - Add migration and testing documentation -8. `35f7c98` - Fix default make target for Netlify deployment -9. `27b8428` - Add automatic dependency setup to Makefile -10. `9d523fd` - Switch to uv sync for proper dependency management -11. `a55cc38` - Fix seaborn API compatibility for 0.13+ -12. `7f31ca9` - Fix all seaborn and Altair compatibility issues -13. `e7639cc` - Add Chrome installation for Kaleido v1 support - -## 🎯 Success Criteria - -- [x] Python 3.11 environment -- [x] uv package manager -- [x] All dependencies install automatically -- [x] Notebook executes without errors -- [x] R ggplot2 examples work -- [x] plotly examples render to PNG -- [x] seaborn examples work with 0.13+ -- [x] plotnine examples work with 0.15+ -- [ ] Altair examples render to PNG (pending) -- [ ] Full site renders successfully -- [ ] GitHub Actions CI passes -- [ ] Netlify deployment works - -## 💡 Recommendations - -1. **Short-term**: Use `make qrender` with a pre-executed notebook that has working PNG outputs -2. **Medium-term**: Fix Altair PNG rendering for complete automation -3. **Long-term**: Consider adding more modern libraries (Polars, etc.) - ---- - -**Modernization Duration**: ~2 hours -**Libraries Updated**: 7 plotting libraries + 140+ dependencies -**Breaking Changes Fixed**: 4 seaborn, 1 plotly, 1 altair -**Infrastructure**: Fully modernized to 2025 standards diff --git a/TESTING_CHECKLIST.md b/TESTING_CHECKLIST.md deleted file mode 100644 index 90bf061..0000000 --- a/TESTING_CHECKLIST.md +++ /dev/null @@ -1,111 +0,0 @@ -# Testing Checklist for Modernized Build - -This checklist should be completed after setting up the modernized development environment. - -## Environment Setup Testing - -- [ ] **Install R** (if not already installed) - ```bash - # macOS - brew install r - - # Ubuntu/Debian - sudo apt-get install r-base r-base-dev - ``` - -- [ ] **Run R setup script** - ```bash - ./setup_r.sh - ``` - Expected: ggplot2 and mgcv packages installed successfully - -- [ ] **Install Python dependencies with uv** - ```bash - # Install uv if needed - curl -LsSf https://astral.sh/uv/install.sh | sh - - # Install dependencies - uv pip install -r requirements.txt - ``` - Expected: All packages install without errors - -- [ ] **Verify R integration** - ```bash - python -c "import rpy2.robjects as ro; ro.r('library(ggplot2)'); print('R integration works!')" - ``` - Expected: No errors, prints "R integration works!" - -## Build Testing - -- [ ] **Run tests** - ```bash - make test - ``` - Expected: All tests pass - -- [ ] **Quick render test (without notebook execution)** - ```bash - make qrender - ``` - Expected: Generates web/index.html from existing Examples.ipynb - -- [ ] **Full build test (with notebook execution)** - ```bash - make render - ``` - Expected: - - Executes notebook successfully - - Generates all plot images in web/img/plots/ - - Creates web/index.html - - No errors from any plotting library - -## Known Migration Issues to Watch For - -### Plotly v5 Changes -- [ ] Verify plotly plots render without authentication -- [ ] Check that Kaleido is used for static image export (not Orca) -- [ ] Ensure all plotly examples in notebook still work - -### Altair v5 Changes -- [ ] Verify altair plots render to PNG -- [ ] Confirm altair-saver is not needed (using native rendering) -- [ ] Check selenium/geckodriver works for image export - -### plotnine 0.13+ Changes -- [ ] Verify all ggplot-style plots render correctly -- [ ] Check for any deprecation warnings - -### statsmodels 0.14+ Changes -- [ ] Verify regression line plots work -- [ ] Check confidence interval calculations - -### rpy2 3.5+ Changes -- [ ] Verify %%R magic commands work -- [ ] Check data passing between Python and R -- [ ] Ensure all R ggplot2 examples render - -### Selenium 4+ Changes -- [ ] Verify geckodriver compatibility -- [ ] Check headless browser operations -- [ ] Test with xvfb if on Linux - -## CI/CD Testing - -- [ ] **GitHub Actions workflow** - - Push to a test branch - - Verify all workflow steps complete - - Check Netlify preview deploy works - - Merge to master and verify production deploy - -## Performance Checks - -- [ ] Note build time for comparison (old vs new) -- [ ] Check generated image file sizes -- [ ] Verify web/index.html loads correctly in browser - -## Rollback Plan - -If critical issues are found: -1. Keep Travis CI config (.travis.yml) until GitHub Actions is confirmed working -2. Document any notebook cells that fail with new library versions -3. Consider pinning problematic packages to older versions temporarily diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 9e71f78..0000000 --- a/environment.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: pythonplot -channels: - - r - - defaults - - plotly -dependencies: - - python>=3.6 - - pip - - mro-base - - r-ggplot2 - - plotly-orca diff --git a/netlify_deploy.sh b/netlify_deploy.sh deleted file mode 100755 index 4096afc..0000000 --- a/netlify_deploy.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -if [ $TRAVIS_BRANCH = "master" ]; then - netlify deploy \ - --auth $NETLIFY_AUTH_TOKEN \ - --site $NETLIFY_SITE_ID \ - --dir ./web \ - --prod \ - --message "Production deploy from Travis CI" -else - netlify deploy \ - --auth $NETLIFY_AUTH_TOKEN \ - --site $NETLIFY_SITE_ID \ - --dir ./web \ - --message "Preview deploy from Travis CI" -fi diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4d9e416..0000000 --- a/requirements.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Core Jupyter/IPython -ipython>=8.12 -notebook>=7.0 -jupyter>=1.0 - -# Data manipulation -pandas>=2.0 - -# Plotting libraries -matplotlib>=3.7 -seaborn>=0.13 -plotnine>=0.13 -plotly>=5.24 -altair>=5.0 -vl-convert-python>=1.0 - -# Image rendering and export -kaleido>=0.2.1 -pillow>=10.0 -selenium>=4.15 - -# Statistical tools -statsmodels>=0.14 -scikit-misc>=0.3 - -# R integration -rpy2>=3.5 - -# Template rendering -jinja2>=3.1 -jinja2-highlight>=0.6 -markdown>=3.5 - -# Utilities -psutil>=5.9 -tzlocal>=5.0 -simplegeneric>=0.8 - -# Cloud services (for deployment) -boto3>=1.28 - -# Testing -pytest>=7.4 diff --git a/runtime.txt b/runtime.txt deleted file mode 100644 index 2c07333..0000000 --- a/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -3.11 From 58ea0a582985309701a9e9c6fe5534620d1d0bb8 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 14:39:21 -0400 Subject: [PATCH 23/72] Update Makefile and CLAUDE.md for the uv/GitHub Actions build --- CLAUDE.md | 113 +++++++++++++++--------------------------------------- Makefile | 17 +------- 2 files changed, 31 insertions(+), 99 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 213f24a..ac08512 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,6 +15,8 @@ The site is generated from a Jupyter notebook (Examples.ipynb) that contains tag 3. Generates static HTML using Jinja2 templates 4. Outputs PNG images and an HTML file to the `web/` directory +The checked-in Examples.ipynb has no outputs; the site can only be rendered from an executed copy of the notebook. + ### Key Components - **Examples.ipynb**: Source notebook containing plot examples for each library @@ -24,7 +26,7 @@ The site is generated from a Jupyter notebook (Examples.ipynb) that contains tag - Parses cell source code and optional markdown comments - Renders the final HTML using Jinja2 - **templates/t_index.html**: Jinja2 template for the website -- **web/**: Output directory for generated site +- **web/**: Output directory for generated site; web/css/ (checked in) holds custom.css and pygments-native.css - **INTRO.md**: Markdown content for the site introduction ### Cell Tagging System @@ -37,40 +39,32 @@ name:scatter-plot # Maps to names dict in render.py package:seaborn # Maps to packages dict in render.py ``` -Valid plot names and packages are defined in dictionaries at the top of render.py (lines 19-43). +Valid plot names and packages are defined in dictionaries at the top of render.py. ## Development Commands ### Setup Environment ```bash -make dev_environment # Installs Python and R dependencies using uv -make setup # Alternative command (same as dev_environment) +make setup # uv sync, Chrome for Kaleido, R packages ``` **Prerequisites:** -- Python 3.11+ installed on system - R 4.0+ installed separately (via Homebrew, apt, or CRAN) -- uv package manager (auto-installed by make targets if missing) +- uv package manager (auto-installed by make targets if missing; uv provides Python) **Manual Setup:** ```bash -# Install uv -curl -LsSf https://astral.sh/uv/install.sh | sh - -# Install Python dependencies -uv pip install -r requirements.txt - -# Install R packages (ggplot2, mgcv) -./setup_r.sh +uv sync # Python dependencies (pyproject.toml + uv.lock) +uv run kaleido_get_chrome # Chrome for plotly PNG export +./setup_r.sh # R packages (ggplot2, mgcv) ``` ### Build Site ```bash -make qrender # Quick render from Examples.ipynb without executing -make render # Full build: execute notebook, then render (creates timestamped .ipynb) -make # Full build + S3 upload +make qrender # Render from an already-executed Examples.ipynb (fails if outputs are stripped) +make render # Full build: execute notebook, then render (creates git-hash-stamped .ipynb) ``` The render process: @@ -83,10 +77,9 @@ The render process: ```bash make test # Run pytest tests -python -m pytest tests/ ``` -The test suite (tests/test_plots.py) validates that Examples.ipynb contains all expected plot/package combinations defined in the defined_plots dictionary. +The test suite (tests/test_plots.py) validates that Examples.ipynb contains all expected plot/package tag combinations. It reads tags only, so it works on the outputs-stripped notebook. ### Local Development @@ -98,12 +91,10 @@ cd web && python -m http.server ### Image Rendering -All plots are rendered to static PNG images: -- **Plotly**: Uses Kaleido for local rendering (no authentication required with v5+) -- **Altair**: Uses native rendering or selenium/geckodriver -- **R/ggplot2**: Uses rpy2 to interface with system R installation - -**Note**: Plotly authentication is no longer needed with plotly v5+. The old authentication code in `.travis/authenticate_plotly.py` is deprecated. +All plots are rendered to static PNG images inside the executed notebook: +- **Plotly**: `pio.renderers.default = "png"` with Kaleido (needs Chrome; `uv run kaleido_get_chrome`) +- **Altair**: `alt.renderers.enable("png")` with vl-convert-python (set in the notebook's first cell — do not remove) +- **R/ggplot2**: rpy2 against the system R installation (`%%R` cell magic) ## Adding New Plots @@ -113,74 +104,30 @@ All plots are rendered to static PNG images: 4. Keep code lines under ~46 characters to avoid horizontal scrolling in the UI 5. Optionally add a markdown comment in triple quotes on the first line 6. Update tests/test_plots.py to include the new plot in defined_plots -7. Run `make qrender` to test (or `make render` for full rebuild) +7. Run `make render` and inspect web/index.html ## Technical Constraints - Plot code must generate PNG output in the notebook cell -- For plotly, images must be generated via their server (requires credentials) - R code cells must start with `%%R` magic command -- Altair cells must start with `%%altair` magic command - Code lines should wrap to ~46 characters for proper display - All image paths are MD5 hashes of the base64-encoded PNG data ## Dependencies -### Python Environment -- **Python**: 3.11+ (specified in runtime.txt and pyproject.toml) -- **Package Manager**: uv (modern, fast alternative to pip) -- **Jupyter**: For notebook execution - -### Plotting Libraries (all latest versions) -- pandas 2.0+ -- matplotlib 3.7+ -- seaborn 0.13+ -- plotnine 0.13+ -- plotly 5.24+ (with Kaleido for image export) -- altair 5.0+ -- statsmodels 0.14+ - -### R Environment -- **R**: 4.0+ (system installation required) -- **R Packages**: ggplot2, mgcv -- **Python-R Bridge**: rpy2 3.5+ - -### Other Key Dependencies -- Jinja2 with jinja2-highlight for templating -- selenium 4.15+ with geckodriver for browser automation -- markdown for text processing - -**Configuration Files:** -- `pyproject.toml`: Modern Python project metadata and dependencies -- `requirements.txt`: Pin-free dependency list -- `setup_r.sh`: R package installation script +Python dependencies are declared in `pyproject.toml` and locked in `uv.lock` (committed). Key libraries: pandas, matplotlib, seaborn, plotnine, plotly (+kaleido), altair (+vl-convert-python), statsmodels, rpy2, Jinja2 with jinja2-highlight. + +R (system install) with ggplot2 and mgcv, installed by `setup_r.sh`. ## CI/CD -The project uses **GitHub Actions** for continuous integration and deployment (migrated from Travis CI). - -### Workflow (.github/workflows/deploy.yml) - -**On Every Push:** -1. Setup R 4.3 using r-lib/setup-r action -2. Install R packages (ggplot2, mgcv) -3. Setup Python 3.11 -4. Install uv and Python dependencies -5. Setup Firefox and geckodriver for selenium -6. Run pytest tests with xvfb (virtual display) -7. Execute notebook and render site -8. Deploy to Netlify: - - **master branch**: Production deployment - - **Other branches**: Preview deployments - -**Required Secrets:** -- `NETLIFY_AUTH_TOKEN`: Netlify authentication token -- `NETLIFY_SITE_ID`: Netlify site identifier - -**Environment Variables:** -- `R_HOME`: Set to R installation path (e.g., `/opt/R/4.3.3/lib/R` on GitHub runners) - -### Legacy CI Files -- `.travis.yml`: Old Travis CI config (deprecated) -- `.travis/`: Old CI scripts (mostly deprecated) -- `.travis/authenticate_plotly.py`: No longer needed with plotly v5+ +GitHub Actions (`.github/workflows/deploy.yml`) on every push: + +1. Setup R (r-lib/actions, RSPM binary packages) and install ggplot2/mgcv +2. Install uv (astral-sh/setup-uv with caching) and `uv sync` +3. `uv run kaleido_get_chrome` +4. Run pytest +5. Execute notebook and render site +6. Deploy to Netlify: production on master pushes, preview otherwise + +**Required Secrets:** `NETLIFY_AUTH_TOKEN`, `NETLIFY_SITE_ID` diff --git a/Makefile b/Makefile index d89b614..71adbc1 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,14 @@ GIT_COMMIT=$(shell git log -1 --pretty=format:"%h") OUTPUTDIR=web -S3_BUCKET=pythonplot.com - all: render -deploy: render s3_upload - clean: rm -f Examples.*.ipynb rm -f *.pyc rm -f .Rhistory rm -f .setup_done -travis: render - .setup_done: @echo "Setting up development environment..." @echo "1. Installing Python dependencies with uv..." @@ -38,19 +32,10 @@ qrender: .setup_done render: .setup_done run_nb uv run python render.py "Examples.$(GIT_COMMIT).ipynb" -s3_upload: - s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed --guess-mime-type --no-mime-magic --no-preserve - run_nb: .setup_done uv run jupyter nbconvert --to notebook --execute "Examples.ipynb" --output "Examples.$(GIT_COMMIT).ipynb" dev_environment: setup @echo "Development environment ready!" - @echo "" - @echo "Note: This project now uses uv instead of conda." - @echo "R must be installed separately on your system." - -cloudfront_invalidate: - python .travis/invalidate_cloudfront.py -.PHONY: all deploy qrender render s3_upload run_nb travis clean cloudfront_invalidate test dev_environment setup +.PHONY: all qrender render run_nb clean test dev_environment setup From 3d37cbe6f85329135a0bd31bd995ea67682a0df2 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 20:24:34 -0400 Subject: [PATCH 24/72] Deploy to Cloudflare Pages instead of Netlify --- .github/workflows/deploy.yml | 32 ++++++++++---------------------- .gitignore | 2 -- CLAUDE.md | 9 +++++++-- README.md | 6 +++--- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a131f43..2cddbe7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -43,33 +43,21 @@ jobs: - name: Render site run: uv run python render.py Examples.build.ipynb - - name: Deploy to Netlify (Production) + - name: Deploy to Cloudflare Pages (Production) if: github.ref == 'refs/heads/master' && github.event_name == 'push' - uses: nwtgck/actions-netlify@v3 + uses: cloudflare/wrangler-action@v3 with: - publish-dir: ./web - production-deploy: true - github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: "Deploy from GitHub Actions - ${{ github.event.head_commit.message }}" - enable-pull-request-comment: false - enable-commit-comment: false - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy web --project-name=pythonplot --branch=main - - name: Deploy to Netlify (Preview) + - name: Deploy to Cloudflare Pages (Preview) if: github.ref != 'refs/heads/master' - uses: nwtgck/actions-netlify@v3 + uses: cloudflare/wrangler-action@v3 with: - publish-dir: ./web - production-deploy: false - github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: "Preview deploy from GitHub Actions" - enable-pull-request-comment: true - enable-commit-comment: false - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy web --project-name=pythonplot --branch=${{ github.head_ref || github.ref_name }} - name: Upload build artifacts if: always() diff --git a/.gitignore b/.gitignore index 1959b07..3fcb627 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,3 @@ Examples.*.ipynb .setup_done .venv/ __pycache__/ -# Local Netlify folder -.netlify diff --git a/CLAUDE.md b/CLAUDE.md index ac08512..db66f9f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -128,6 +128,11 @@ GitHub Actions (`.github/workflows/deploy.yml`) on every push: 3. `uv run kaleido_get_chrome` 4. Run pytest 5. Execute notebook and render site -6. Deploy to Netlify: production on master pushes, preview otherwise +6. Deploy `web/` to Cloudflare Pages (project `pythonplot`, direct upload via `cloudflare/wrangler-action`) -**Required Secrets:** `NETLIFY_AUTH_TOKEN`, `NETLIFY_SITE_ID` +Master pushes deploy with `--branch=main`, which the Cloudflare project treats as its +production branch (pythonplot.com, www.pythonplot.com). Every other branch deploys with +its own branch name, producing a preview URL. + +**Required Secrets:** `CLOUDFLARE_API_TOKEN` (needs the Cloudflare Pages: Edit +permission), `CLOUDFLARE_ACCOUNT_ID` diff --git a/README.md b/README.md index b27ba17..bd66fc2 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,6 @@ cd web && python -m http.server #### CI/CD The project uses GitHub Actions for continuous integration and deployment: -- **Pushes to `master`**: Automatically deployed to production on Netlify -- **Other branches**: Create preview deployments on Netlify -- Requires secrets: `NETLIFY_AUTH_TOKEN` and `NETLIFY_SITE_ID` \ No newline at end of file +- **Pushes to `master`**: Deployed to production on the Cloudflare Pages project `pythonplot` +- **Other branches**: Create preview deployments on Cloudflare Pages +- Requires secrets: `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` \ No newline at end of file From 169c40345c6607b40090b00b6c3d16cbe385cc7e Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 20:35:19 -0400 Subject: [PATCH 25/72] Skip Cloudflare deploy steps when CLOUDFLARE_API_TOKEN is not configured --- .github/workflows/deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2cddbe7..f75a3e2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,6 +9,8 @@ on: jobs: build-and-deploy: runs-on: ubuntu-latest + env: + HAS_CF_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN != '' }} steps: - name: Checkout code @@ -44,7 +46,7 @@ jobs: run: uv run python render.py Examples.build.ipynb - name: Deploy to Cloudflare Pages (Production) - if: github.ref == 'refs/heads/master' && github.event_name == 'push' + if: github.ref == 'refs/heads/master' && github.event_name == 'push' && env.HAS_CF_TOKEN == 'true' uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} @@ -52,7 +54,7 @@ jobs: command: pages deploy web --project-name=pythonplot --branch=main - name: Deploy to Cloudflare Pages (Preview) - if: github.ref != 'refs/heads/master' + if: github.ref != 'refs/heads/master' && env.HAS_CF_TOKEN == 'true' uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} From 72e89b1178e8b3f983ea544a4ad497099dc46249 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 20:30:56 -0400 Subject: [PATCH 26/72] Add lets-plot examples for all 13 plots Lets-Plot renders to PNG through ggsave; an IPython image/png formatter registered on PlotSpec keeps the example cells free of export boilerplate. It is imported as lp so its ggplot2-style names do not shadow plotnine's. --- Examples.ipynb | 243 +++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 1 + render.py | 1 + tests/test_plots.py | 46 +++++++-- uv.lock | 57 +++++++++++ 5 files changed, 335 insertions(+), 13 deletions(-) diff --git a/Examples.ipynb b/Examples.ipynb index 548f724..1e7db06 100644 --- a/Examples.ipynb +++ b/Examples.ipynb @@ -5,7 +5,7 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": "%matplotlib inline\n\nimport readline\nimport altair as alt\nimport pandas as pd\nimport seaborn as sns\nfrom matplotlib import pyplot\nfrom plotnine import *\nimport numpy as np\n\nfrom plotly import figure_factory\nfrom plotly import graph_objects\nimport plotly.express as px\nfrom IPython.core.magic import Magics, magics_class, cell_magic\n\nfrom IPython.display import Image\n\nfrom pylab import rcParams\n\nsize = 20\nparams = {\n \"legend.fontsize\": size,\n \"figure.figsize\": (15, 5),\n \"axes.labelsize\": size,\n \"axes.titlesize\": size,\n \"xtick.labelsize\": size,\n \"ytick.labelsize\": size,\n \"axes.titlesize\": 1.5 * size,\n \"figure.figsize\": (12, 12),\n}\nrcParams.update(params)\ntheme_update(\n figure_size=(9, 9),\n title=element_text(size=size),\n text=element_text(size=0.6 * size),\n) # for plotnine\n\n\nimport plotly.io as pio\npio.renderers.default = \"png\"\npio.renderers[\"png\"].width = 750\npio.renderers[\"png\"].height = 750\n\n# Render Altair charts as PNG via vl-convert\nalt.renderers.enable(\"png\", scale_factor=2.0)" + "source": "%matplotlib inline\n\nimport readline\nimport altair as alt\nimport pandas as pd\nimport seaborn as sns\nfrom matplotlib import pyplot\nfrom plotnine import *\nimport numpy as np\n\nfrom plotly import figure_factory\nfrom plotly import graph_objects\nimport plotly.express as px\nfrom IPython.core.magic import Magics, magics_class, cell_magic\n\nfrom IPython.display import Image\n\nfrom pylab import rcParams\n\nsize = 20\nparams = {\n \"legend.fontsize\": size,\n \"figure.figsize\": (15, 5),\n \"axes.labelsize\": size,\n \"axes.titlesize\": size,\n \"xtick.labelsize\": size,\n \"ytick.labelsize\": size,\n \"axes.titlesize\": 1.5 * size,\n \"figure.figsize\": (12, 12),\n}\nrcParams.update(params)\ntheme_update(\n figure_size=(9, 9),\n title=element_text(size=size),\n text=element_text(size=0.6 * size),\n) # for plotnine\n\n\nimport plotly.io as pio\npio.renderers.default = \"png\"\npio.renderers[\"png\"].width = 750\npio.renderers[\"png\"].height = 750\n\n# Render Altair charts as PNG via vl-convert\nalt.renderers.enable(\"png\", scale_factor=2.0)\n\nimport tempfile\n\nimport lets_plot as lp\nfrom lets_plot.export import ggsave\n\nlp.LetsPlot.setup_html()\nlp.LetsPlot.set_theme(\n lp.theme(text=lp.element_text(size=16), title=lp.element_text(size=20))\n)\n\n_LETS_PLOT_DIR = tempfile.mkdtemp(prefix=\"lets-plot-\")\n\n\ndef _lets_plot_png(plot):\n \"\"\"Render a Lets-Plot spec to PNG so the cell output carries an image.\"\"\"\n path = ggsave(plot + lp.ggsize(750, 750), \"plot.png\", path=_LETS_PLOT_DIR)\n with open(path, \"rb\") as f:\n return f.read()\n\n\nget_ipython().display_formatter.formatters[\"image/png\"].for_type(\n lp.plot.core.PlotSpec, _lets_plot_png\n)" }, { "cell_type": "code", @@ -227,6 +227,28 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:bar-counts", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "\"\"\"Lets-Plot mirrors the ggplot2 grammar. It is imported as `lp` here\n", + "so its names don't collide with plotnine's.\n", + "\"\"\"\n", + "(lp.ggplot(mpg) +\n", + " lp.aes(x=\"manufacturer\") +\n", + " lp.geom_bar() +\n", + " lp.coord_flip() +\n", + " lp.ggtitle(\"Number of Cars by Make\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -344,6 +366,23 @@ " geom_histogram(binwidth=2))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:simple-histogram", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(mpg) +\n", + " lp.aes(x=\"cty\") +\n", + " lp.geom_histogram(binwidth=2))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -452,6 +491,26 @@ " ylab(\"Highway MPG\"))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(mpg) +\n", + " lp.aes(x=\"displ\", y=\"hwy\") +\n", + " lp.geom_point() +\n", + " lp.ggtitle(\"Engine Displacement in Liters vs Highway MPG\") +\n", + " lp.xlab(\"Engine Displacement in Liters\") +\n", + " lp.ylab(\"Highway MPG\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -543,6 +602,24 @@ " geom_smooth(method=\"lm\"))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-with-regression", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(mpg) +\n", + " lp.aes(\"displ\", \"hwy\") +\n", + " lp.geom_point() +\n", + " lp.geom_smooth(method=\"lm\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -762,6 +839,26 @@ " ylab(\"Highway MPG\"))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-colors", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(mpg) +\n", + " lp.aes(x=\"displ\", y=\"hwy\", color=\"class\") +\n", + " lp.geom_point() +\n", + " lp.ggtitle(\"Engine Displacement in Liters vs Highway MPG\") +\n", + " lp.xlab(\"Engine Displacement in Liters\") +\n", + " lp.ylab(\"Highway MPG\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -883,6 +980,23 @@ " geom_point(alpha=.5))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-size", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(mpg) +\n", + " lp.aes(x=\"cty\", y=\"hwy\", size=\"cyl\") +\n", + " lp.geom_point(alpha=.5))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -989,6 +1103,24 @@ " facet_wrap(\" ~ c\", nrow = 2))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-facet", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(mpg) +\n", + " lp.aes(x=\"displ\", y=\"hwy\") +\n", + " lp.geom_point() +\n", + " lp.facet_wrap(facets=\"class\", nrow=2))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1097,6 +1229,24 @@ " facet_grid(\"drv ~ cyl\"))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-facets", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(mpg) +\n", + " lp.aes(x=\"displ\", y=\"hwy\") +\n", + " lp.geom_point() +\n", + " lp.facet_grid(x=\"cyl\", y=\"drv\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1214,6 +1364,26 @@ " ))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:stacked-smooth-line-and-scatter", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(mpg) +\n", + " lp.aes(x=\"displ\", y=\"hwy\") +\n", + " lp.geom_point(lp.aes(color=\"class\")) +\n", + " lp.geom_smooth(data=mpg[mpg[\"class\"] == \"subcompact\"],\n", + " se=False,\n", + " method=\"loess\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1301,6 +1471,23 @@ " geom_bar())" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:stacked-bar-chart", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(diamonds) +\n", + " lp.aes(x=\"cut\", fill=\"clarity\") +\n", + " lp.geom_bar())" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1415,6 +1602,23 @@ " geom_bar(position = \"dodge\"))\n" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:dodged-bar-chart", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(diamonds) +\n", + " lp.aes(x=\"cut\", fill=\"clarity\") +\n", + " lp.geom_bar(position=\"dodge\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1530,6 +1734,24 @@ " geom_density(alpha=0.1))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:stacked-kde", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(diamonds) +\n", + " lp.aes(\"depth\", fill=\"cut\", color=\"cut\") +\n", + " lp.geom_density(alpha=0.1) +\n", + " lp.xlim(55, 70))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1614,6 +1836,23 @@ " + geom_line())" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:timeseries", + "package:lets-plot" + ] + }, + "outputs": [], + "source": [ + "(lp.ggplot(ts)\n", + " + lp.aes(\"date\", \"value\")\n", + " + lp.geom_line())" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1686,4 +1925,4 @@ }, "nbformat": 4, "nbformat_minor": 1 -} \ No newline at end of file +} diff --git a/pyproject.toml b/pyproject.toml index e10669b..089edbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ dependencies = [ "matplotlib>=3.7", "seaborn>=0.13", "plotnine>=0.13", + "lets-plot>=4.11", "plotly>=5.24", "altair>=5.0", "vl-convert-python>=1.0", # Required for Altair PNG export diff --git a/render.py b/render.py index 7d06749..7173fc2 100644 --- a/render.py +++ b/render.py @@ -21,6 +21,7 @@ "matplotlib": "Matplotlib", "seaborn": "Seaborn", "plotnine": "plotnine", + "lets-plot": "lets-plot", "plotly": "plotly", "altair": "Altair", "ggplot": "ggplot2 (R)", diff --git a/tests/test_plots.py b/tests/test_plots.py index da53da9..4bd99c4 100644 --- a/tests/test_plots.py +++ b/tests/test_plots.py @@ -2,33 +2,57 @@ from collections import defaultdict defined_plots = { - "bar-counts": ["pandas", "plotnine", "ggplot", "plotly", "altair",], - "dodged-bar-chart": ["pandas", "plotnine", "ggplot", "plotly", "altair",], - "scatter-plot": ["pandas", "plotnine", "ggplot", "plotly", "altair",], + "bar-counts": [ + "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], + "dodged-bar-chart": [ + "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], + "scatter-plot": [ + "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], "scatter-plot-with-colors": [ "matplotlib", "seaborn", "plotnine", + "lets-plot", "ggplot", "plotly", "altair", ], - "scatter-plot-with-facet": ["seaborn", "plotnine", "ggplot", "plotly", "altair",], - "scatter-plot-with-facets": ["seaborn", "plotnine", "ggplot", "plotly", "altair",], - "scatter-plot-with-size": ["pandas", "plotnine", "ggplot", "plotly", "altair",], - "scatter-with-regression": ["seaborn", "plotnine", "ggplot", "plotly",], + "scatter-plot-with-facet": [ + "seaborn", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], + "scatter-plot-with-facets": [ + "seaborn", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], + "scatter-plot-with-size": [ + "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], + "scatter-with-regression": [ + "seaborn", "plotnine", "lets-plot", "ggplot", "plotly", + ], "simple-histogram": [ "pandas", "matplotlib", "plotnine", + "lets-plot", "ggplot", "plotly", "altair", ], - "stacked-bar-chart": ["pandas", "plotnine", "ggplot", "plotly", "altair",], - "stacked-kde": ["pandas", "seaborn", "plotnine", "ggplot", "plotly", "altair",], - "stacked-smooth-line-and-scatter": ["plotnine", "ggplot", "plotly", "altair",], - "timeseries": ["pandas", "plotnine", "ggplot", "plotly", "altair",], + "stacked-bar-chart": [ + "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], + "stacked-kde": [ + "pandas", "seaborn", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], + "stacked-smooth-line-and-scatter": [ + "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], + "timeseries": [ + "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + ], } diff --git a/uv.lock b/uv.lock index 574804b..1ff7ce9 100644 --- a/uv.lock +++ b/uv.lock @@ -1202,6 +1202,43 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/82/3d/14ce75ef66813643812f3093ab17e46d3a206942ce7376d31ec2d36229e7/lark-1.3.1-py3-none-any.whl", hash = "sha256:c629b661023a014c37da873b4ff58a817398d12635d3bbb2c5a03be7fe5d1e12", size = 113151, upload-time = "2025-10-27T18:25:54.882Z" }, ] +[[package]] +name = "lets-plot" +version = "4.11.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "palettable" }, + { name = "pillow" }, + { name = "pypng" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/50/e8/df04b5b833c8fa89cbc7bcb5478166066c988fc302b050e8d58dc1bbf998/lets_plot-4.11.0-cp311-cp311-macosx_10_15_x86_64.whl", hash = "sha256:2114bdcbe73aafa1512779a3cd064e96b50fee37fca7ed78018aeaef224c8bc7", size = 7313995, upload-time = "2026-06-30T13:22:58.181Z" }, + { url = "https://files.pythonhosted.org/packages/82/3f/38578337f31bfc0491470023b0bc4514cf043880474d7d0eb8ccdc96ff73/lets_plot-4.11.0-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:b5b72268fbce91b21cebd75028b79a9766584a79a4f2b278cedd5c3fcd9c13e8", size = 6861264, upload-time = "2026-06-30T13:22:48.03Z" }, + { url = "https://files.pythonhosted.org/packages/46/30/410281f6bd2ba7104308aeac08ae8472c0cc0812bd7ea934de2878453a3c/lets_plot-4.11.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:986fb279ca3e5aea05687374be97fb82a227814039d406ffc076ea71ff6fdcb1", size = 7175380, upload-time = "2026-06-30T13:22:46.201Z" }, + { url = "https://files.pythonhosted.org/packages/ae/56/e65ca7899579ec2a29cb4ee29f5ccadaefa7490cec2a056a77d97182ffa5/lets_plot-4.11.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7a36f999221513eb6d36fb7120c8b44bded1ff0138a3e5947a10560da62e9070", size = 7890925, upload-time = "2026-06-30T13:22:51.427Z" }, + { url = "https://files.pythonhosted.org/packages/96/d7/67adeaa76d6beabe30b359a83d99dcf793a71448055b9b1cbdad116d7504/lets_plot-4.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:212d140eda98138f1de4af2311c251b4cf6d71ccf956dd6d4976eb64eebd571d", size = 6599864, upload-time = "2026-06-30T13:22:49.658Z" }, + { url = "https://files.pythonhosted.org/packages/2c/78/d65586bcf7b58fe39aa06f945331a6d22a4663402284eddf6517a1cc48b6/lets_plot-4.11.0-cp312-cp312-macosx_10_15_x86_64.whl", hash = "sha256:33e0e85e20e3d15e4434cc4766a84369d0142e03fb21ddc15cca2aab3956d5aa", size = 7314019, upload-time = "2026-06-30T13:23:22.554Z" }, + { url = "https://files.pythonhosted.org/packages/77/f1/da86eef569031973cfccc707d60e171f37f2126af1b8d5246a9e033310a4/lets_plot-4.11.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:2d04baafc53cc928710a9521237644f6e09f5c19586958977045eebdf0951621", size = 6861235, upload-time = "2026-06-30T13:22:56.624Z" }, + { url = "https://files.pythonhosted.org/packages/0e/ed/0acbc30b86ceeb886e04c30a8ba04a40b9e0808114f0dfc3cf077e7b6c01/lets_plot-4.11.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:a162126d8199f1470f86a053d3c7f604baae2cbe7b7fea671f60d725e9f24117", size = 7175665, upload-time = "2026-06-30T13:22:53.151Z" }, + { url = "https://files.pythonhosted.org/packages/5a/97/4aec890acdd82eb1bfc0b39a7e93efe3740e1ae1cfd373e6960b2a2ed8c7/lets_plot-4.11.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:130c591553e0aa54d1340935c0c1ff9aec5a42b2a8f10f3b5bface8a88e08f82", size = 7890857, upload-time = "2026-06-30T13:22:36.596Z" }, + { url = "https://files.pythonhosted.org/packages/44/58/52f4e3e765c12e683e47dc95935af665c97261c015eaacbcf89722aff07d/lets_plot-4.11.0-cp312-cp312-win_amd64.whl", hash = "sha256:bdf2b6bad57763a834c745a8e845becd8e19e40c6cc0421868ed0067b7ae31fb", size = 6600021, upload-time = "2026-06-30T13:22:54.876Z" }, + { url = "https://files.pythonhosted.org/packages/3c/2a/47e444e21ca3070fd8615c70ac2b93a91617fac9a6e5e13c9f73b6f8fe6b/lets_plot-4.11.0-cp313-cp313-macosx_10_15_x86_64.whl", hash = "sha256:ed10c01b1a7dd077a95522bd7ae2d84b05bd7331fd8f433ae9bcaa7b7bf1bb62", size = 7314018, upload-time = "2026-06-30T13:22:39.067Z" }, + { url = "https://files.pythonhosted.org/packages/5f/bc/7edb27519b1df5a31578f1049da0409df7294cdc10bf95c79a03444858bd/lets_plot-4.11.0-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:235bdbbca1245948b2cc97834ddd03d3c672701557bd2633a272975e63dc80c4", size = 6861236, upload-time = "2026-06-30T13:23:18.034Z" }, + { url = "https://files.pythonhosted.org/packages/28/5a/99a5223b29c76323fb3f0ac7aa9103771d06b0d0abb5bdf059327fdbfe0f/lets_plot-4.11.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:3061176d3c940425878262b4f3d86bd4c22aa28f491c8a4b251b926ec0a18428", size = 7175635, upload-time = "2026-06-30T13:23:10.877Z" }, + { url = "https://files.pythonhosted.org/packages/a2/91/dd3b3def5958de3705a3b571c6a667f165fc44da41b3b6122fd7de0993bf/lets_plot-4.11.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:455101b29f0110b9aa22a5148c8ebd79c1be545e20592143e9792ca8e7a5ffd7", size = 7890804, upload-time = "2026-06-30T13:22:44.307Z" }, + { url = "https://files.pythonhosted.org/packages/9e/f1/7546add6ac86af06047a966b5209ef2e28fd6bdd15f8a67fa4be1efd08ef/lets_plot-4.11.0-cp313-cp313-win_amd64.whl", hash = "sha256:fbc89599b1bdd22611080bce3566aae9e15ed04702636bf1d8cc3cec140f9ac2", size = 6599865, upload-time = "2026-06-30T13:23:05.107Z" }, + { url = "https://files.pythonhosted.org/packages/51/6d/c6d3f068b5e86b7e92dc4f4ccc0c422c10ea6be898478032bf92a7ea97e5/lets_plot-4.11.0-cp314-cp314-macosx_11_0_x86_64.whl", hash = "sha256:b5e4c0949ee9729a59353fac2d74aa48c813de2a6cfbf5762521f911e6b05884", size = 7379628, upload-time = "2026-06-30T13:23:14.47Z" }, + { url = "https://files.pythonhosted.org/packages/4a/22/61fe4efb8e9cef175dd30813648e883345fed649a7b68f4be71fcb2f7cbc/lets_plot-4.11.0-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:d53da88c0e2448c811f44c6f3a71fba3b48ea471f6114467da2472ab09252146", size = 6861239, upload-time = "2026-06-30T13:23:26.232Z" }, + { url = "https://files.pythonhosted.org/packages/6a/43/e516ec41512f69153f9eb33da4b65067fb174bcc939a4a58bf5102c73473/lets_plot-4.11.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:681e4d11f539615122355f53ce910844de211c44654bb0a0aec9c204b36a1944", size = 7175688, upload-time = "2026-06-30T13:23:01.444Z" }, + { url = "https://files.pythonhosted.org/packages/81/0d/0066c34f0a1244cd8a13e7362486041c34289efb1ee822a64f7c3ce384f1/lets_plot-4.11.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:015f93dab1a4358d3a034bffff21ea16725ffb79d9fc113e4ff58d4ba0a13e91", size = 7890868, upload-time = "2026-06-30T13:23:06.794Z" }, + { url = "https://files.pythonhosted.org/packages/d5/30/e812334963aa9502e25af56e73abd2225af0e6fadc4db1e893374e9b1f10/lets_plot-4.11.0-cp314-cp314-win_amd64.whl", hash = "sha256:2849191780092a3ee99cdcc1fd7733665c39900cc1872cf66b1a5f8779c53afe", size = 6599881, upload-time = "2026-06-30T13:23:03.241Z" }, + { url = "https://files.pythonhosted.org/packages/cf/84/9921fb975beae6d403d2ae8d9fa0e68d608a8d75c14e0c41c1a624d50bc4/lets_plot-4.11.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:060602fbe92eefa3151b0aaa6684e3d420652220dad771752cb4821a9cac1aa3", size = 6917001, upload-time = "2026-06-30T13:23:24.403Z" }, + { url = "https://files.pythonhosted.org/packages/b1/9a/ea1deafd231061e2cce199085fbe37dde9ecc9810977dfb3cd33066ea01f/lets_plot-4.11.0-cp314-cp314t-macosx_11_0_x86_64.whl", hash = "sha256:d5f8b1151266c41c0cd8b931c7a59a6d231b6892da58fbfcbee793f2052beee6", size = 7379483, upload-time = "2026-06-30T13:23:16.212Z" }, + { url = "https://files.pythonhosted.org/packages/97/9a/52d72f65db8d12bc94be0bf085dec94f3198e871d0c09ea9af9cfbc88f6f/lets_plot-4.11.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:2e5155eefc9829fe8775cc75a5ead0034a9673ba88813f11d8737594ba1253ee", size = 7177030, upload-time = "2026-06-30T13:23:20.6Z" }, + { url = "https://files.pythonhosted.org/packages/7a/2d/e8852858e64942e10438ca0235ea9a0d6064e17ef48e522d444681c62836/lets_plot-4.11.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3f0925f7f9a7293115385af77452b9d03bfab64e8fc3bb1b84d5101ec0d339e8", size = 7890954, upload-time = "2026-06-30T13:22:42.308Z" }, + { url = "https://files.pythonhosted.org/packages/d9/21/f6fa7129af18153707ffe23aa7a89adc20225e7aa35976f0424e13c6940c/lets_plot-4.11.0-cp314-cp314t-win_amd64.whl", hash = "sha256:366410ddc5e063ca4c1685afd7c0b8f8dcd20946d3abc63d1024c3ef4f706992", size = 6599801, upload-time = "2026-06-30T13:22:40.752Z" }, +] + [[package]] name = "logistro" version = "2.0.1" @@ -1728,6 +1765,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" }, ] +[[package]] +name = "palettable" +version = "3.3.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/dc/3d/a5854d60850485bff12f28abfe0e17f503e866763bed61aed4990b604530/palettable-3.3.3.tar.gz", hash = "sha256:094dd7d9a5fc1cca4854773e5c1fc6a315b33bd5b3a8f47064928facaf0490a8", size = 106639, upload-time = "2023-04-19T23:13:35.864Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cf/f7/3367feadd4ab56783b0971c9b7edfbdd68e0c70ce877949a5dd2117ed4a0/palettable-3.3.3-py2.py3-none-any.whl", hash = "sha256:74e9e7d7fe5a9be065e02397558ed1777b2df0b793a6f4ce1a5ee74f74fb0caa", size = 332251, upload-time = "2023-04-19T23:13:33.996Z" }, +] + [[package]] name = "pandas" version = "3.0.5" @@ -2086,6 +2132,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/10/bd/c038d7cc38edc1aa5bf91ab8068b63d4308c66c4c8bb3cbba7dfbc049f9c/pyparsing-3.3.2-py3-none-any.whl", hash = "sha256:850ba148bd908d7e2411587e247a1e4f0327839c40e2e5e6d05a007ecc69911d", size = 122781, upload-time = "2026-01-21T03:57:55.912Z" }, ] +[[package]] +name = "pypng" +version = "0.20220715.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/93/cd/112f092ec27cca83e0516de0a3368dbd9128c187fb6b52aaaa7cde39c96d/pypng-0.20220715.0.tar.gz", hash = "sha256:739c433ba96f078315de54c0db975aee537cbc3e1d0ae4ed9aab0ca1e427e2c1", size = 128992, upload-time = "2022-07-15T14:11:05.301Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3e/b9/3766cc361d93edb2ce81e2e1f87dd98f314d7d513877a342d31b30741680/pypng-0.20220715.0-py3-none-any.whl", hash = "sha256:4a43e969b8f5aaafb2a415536c1a8ec7e341cd6a3f957fd5b5f32a4cfeed902c", size = 58057, upload-time = "2022-07-15T14:11:03.713Z" }, +] + [[package]] name = "pytest" version = "9.1.1" @@ -2135,6 +2190,7 @@ dependencies = [ { name = "jinja2-highlight" }, { name = "jupyter" }, { name = "kaleido" }, + { name = "lets-plot" }, { name = "markdown" }, { name = "matplotlib" }, { name = "notebook" }, @@ -2164,6 +2220,7 @@ requires-dist = [ { name = "jinja2-highlight", specifier = ">=0.6" }, { name = "jupyter", specifier = ">=1.0" }, { name = "kaleido", specifier = ">=1.0" }, + { name = "lets-plot", specifier = ">=4.11" }, { name = "markdown", specifier = ">=3.5" }, { name = "matplotlib", specifier = ">=3.7" }, { name = "notebook", specifier = ">=7.0" }, From 32d2273379ef02a608627689d022e6ad9ae6826a Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 20:33:14 -0400 Subject: [PATCH 27/72] Describe Lets-Plot in the site intro and project docs --- CLAUDE.md | 4 ++-- INTRO.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index db66f9f..490136a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -pythonplot.com is a static website that provides a visual comparison of different Python plotting libraries (pandas, matplotlib, seaborn, plotnine, plotly, altair) and R's ggplot2 for exploratory data analysis. It serves as a "Rosetta Stone" showing how to create the same plots across different libraries. +pythonplot.com is a static website that provides a visual comparison of different Python plotting libraries (pandas, matplotlib, seaborn, plotnine, lets-plot, plotly, altair) and R's ggplot2 for exploratory data analysis. It serves as a "Rosetta Stone" showing how to create the same plots across different libraries. ## Architecture @@ -115,7 +115,7 @@ All plots are rendered to static PNG images inside the executed notebook: ## Dependencies -Python dependencies are declared in `pyproject.toml` and locked in `uv.lock` (committed). Key libraries: pandas, matplotlib, seaborn, plotnine, plotly (+kaleido), altair (+vl-convert-python), statsmodels, rpy2, Jinja2 with jinja2-highlight. +Python dependencies are declared in `pyproject.toml` and locked in `uv.lock` (committed). Key libraries: pandas, matplotlib, seaborn, plotnine, lets-plot, plotly (+kaleido), altair (+vl-convert-python), statsmodels, rpy2, Jinja2 with jinja2-highlight. R (system install) with ggplot2 and mgcv, installed by `setup_r.sh`. diff --git a/INTRO.md b/INTRO.md index ea93ade..9398ad4 100644 --- a/INTRO.md +++ b/INTRO.md @@ -29,6 +29,8 @@ There are several tools that can make the kinds of plots described here. At pres "[plotly](https://plot.ly/ "Plotly - Make charts and dashboards online")'s Python graphing library makes interactive, publication-quality graphs online. Examples of how to make line plots, scatter plots, area charts, bar charts, error bars, box plots, histograms, heatmaps, subplots, multiple-axes, polar charts, and bubble charts." I provide plotly examples rendered as static images. +"[Lets-Plot](https://lets-plot.org/ "Lets-Plot: an open-source plotting library for statistical data") is an open-source plotting library for statistical data," written by JetBrains and modeled on the grammar of graphics. Its Python API tracks ggplot2 closely enough that most of the examples below translate line for line. I provide Lets-Plot examples rendered as static images. + "[Bokeh](http://bokeh.pydata.org/en/latest/ "Python interactive visualization library") is a Python interactive visualization library that targets modern web browsers for presentation." "[bqplot](https://github.com/bloomberg/bqplot) is a Grammar of Graphics-based interactive plotting framework for the Jupyter notebook." From d0a32ae7f2001b604987551a9c8c6ad6bf601e98 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 20:39:57 -0400 Subject: [PATCH 28/72] Register seaborn.objects as a comparison package --- render.py | 1 + tests/test_plots.py | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/render.py b/render.py index 7173fc2..a3164ff 100644 --- a/render.py +++ b/render.py @@ -20,6 +20,7 @@ "pandas": "Pandas", "matplotlib": "Matplotlib", "seaborn": "Seaborn", + "seaborn-objects": "seaborn.objects", "plotnine": "plotnine", "lets-plot": "lets-plot", "plotly": "plotly", diff --git a/tests/test_plots.py b/tests/test_plots.py index 4bd99c4..3a4af40 100644 --- a/tests/test_plots.py +++ b/tests/test_plots.py @@ -3,17 +3,18 @@ defined_plots = { "bar-counts": [ - "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], "dodged-bar-chart": [ - "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], "scatter-plot": [ - "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], "scatter-plot-with-colors": [ "matplotlib", "seaborn", + "seaborn-objects", "plotnine", "lets-plot", "ggplot", @@ -21,13 +22,13 @@ "altair", ], "scatter-plot-with-facet": [ - "seaborn", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "seaborn", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], "scatter-plot-with-facets": [ - "seaborn", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "seaborn", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], "scatter-plot-with-size": [ - "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], "scatter-with-regression": [ "seaborn", "plotnine", "lets-plot", "ggplot", "plotly", @@ -35,6 +36,7 @@ "simple-histogram": [ "pandas", "matplotlib", + "seaborn-objects", "plotnine", "lets-plot", "ggplot", @@ -42,16 +44,23 @@ "altair", ], "stacked-bar-chart": [ - "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], "stacked-kde": [ - "pandas", "seaborn", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "pandas", + "seaborn", + "seaborn-objects", + "plotnine", + "lets-plot", + "ggplot", + "plotly", + "altair", ], "stacked-smooth-line-and-scatter": [ "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], "timeseries": [ - "pandas", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], } From e68081c758ec9d0316d1568441e3063f46147a34 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 20:39:58 -0400 Subject: [PATCH 29/72] Add seaborn.objects examples for eleven plots --- Examples.ipynb | 287 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 286 insertions(+), 1 deletion(-) diff --git a/Examples.ipynb b/Examples.ipynb index 1e7db06..bc5e3e9 100644 --- a/Examples.ipynb +++ b/Examples.ipynb @@ -5,7 +5,93 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": "%matplotlib inline\n\nimport readline\nimport altair as alt\nimport pandas as pd\nimport seaborn as sns\nfrom matplotlib import pyplot\nfrom plotnine import *\nimport numpy as np\n\nfrom plotly import figure_factory\nfrom plotly import graph_objects\nimport plotly.express as px\nfrom IPython.core.magic import Magics, magics_class, cell_magic\n\nfrom IPython.display import Image\n\nfrom pylab import rcParams\n\nsize = 20\nparams = {\n \"legend.fontsize\": size,\n \"figure.figsize\": (15, 5),\n \"axes.labelsize\": size,\n \"axes.titlesize\": size,\n \"xtick.labelsize\": size,\n \"ytick.labelsize\": size,\n \"axes.titlesize\": 1.5 * size,\n \"figure.figsize\": (12, 12),\n}\nrcParams.update(params)\ntheme_update(\n figure_size=(9, 9),\n title=element_text(size=size),\n text=element_text(size=0.6 * size),\n) # for plotnine\n\n\nimport plotly.io as pio\npio.renderers.default = \"png\"\npio.renderers[\"png\"].width = 750\npio.renderers[\"png\"].height = 750\n\n# Render Altair charts as PNG via vl-convert\nalt.renderers.enable(\"png\", scale_factor=2.0)\n\nimport tempfile\n\nimport lets_plot as lp\nfrom lets_plot.export import ggsave\n\nlp.LetsPlot.setup_html()\nlp.LetsPlot.set_theme(\n lp.theme(text=lp.element_text(size=16), title=lp.element_text(size=20))\n)\n\n_LETS_PLOT_DIR = tempfile.mkdtemp(prefix=\"lets-plot-\")\n\n\ndef _lets_plot_png(plot):\n \"\"\"Render a Lets-Plot spec to PNG so the cell output carries an image.\"\"\"\n path = ggsave(plot + lp.ggsize(750, 750), \"plot.png\", path=_LETS_PLOT_DIR)\n with open(path, \"rb\") as f:\n return f.read()\n\n\nget_ipython().display_formatter.formatters[\"image/png\"].for_type(\n lp.plot.core.PlotSpec, _lets_plot_png\n)" + "source": [ + "%matplotlib inline\n", + "\n", + "import readline\n", + "import altair as alt\n", + "import pandas as pd\n", + "import seaborn as sns\n", + "from matplotlib import pyplot\n", + "from plotnine import *\n", + "import numpy as np\n", + "\n", + "from plotly import figure_factory\n", + "from plotly import graph_objects\n", + "import plotly.express as px\n", + "from IPython.core.magic import Magics, magics_class, cell_magic\n", + "\n", + "from IPython.display import Image\n", + "\n", + "from pylab import rcParams\n", + "\n", + "size = 20\n", + "params = {\n", + " \"legend.fontsize\": size,\n", + " \"figure.figsize\": (15, 5),\n", + " \"axes.labelsize\": size,\n", + " \"axes.titlesize\": size,\n", + " \"xtick.labelsize\": size,\n", + " \"ytick.labelsize\": size,\n", + " \"axes.titlesize\": 1.5 * size,\n", + " \"figure.figsize\": (12, 12),\n", + "}\n", + "rcParams.update(params)\n", + "theme_update(\n", + " figure_size=(9, 9),\n", + " title=element_text(size=size),\n", + " text=element_text(size=0.6 * size),\n", + ") # for plotnine\n", + "\n", + "\n", + "import seaborn.objects as so\n", + "\n", + "# Match the other libraries: ~750x750 px output with scaled-up text\n", + "so.Plot.config.display[\"scaling\"] = 1\n", + "so.Plot.config.theme.update(\n", + " {\n", + " \"figure.figsize\": (8, 8),\n", + " \"axes.labelsize\": size,\n", + " \"axes.titlesize\": 1.5 * size,\n", + " \"xtick.labelsize\": size,\n", + " \"ytick.labelsize\": size,\n", + " \"legend.fontsize\": size,\n", + " \"legend.title_fontsize\": size,\n", + " }\n", + ")\n", + "\n", + "import plotly.io as pio\n", + "pio.renderers.default = \"png\"\n", + "pio.renderers[\"png\"].width = 750\n", + "pio.renderers[\"png\"].height = 750\n", + "\n", + "# Render Altair charts as PNG via vl-convert\n", + "alt.renderers.enable(\"png\", scale_factor=2.0)\n", + "\n", + "import tempfile\n", + "\n", + "import lets_plot as lp\n", + "from lets_plot.export import ggsave\n", + "\n", + "lp.LetsPlot.setup_html()\n", + "lp.LetsPlot.set_theme(\n", + " lp.theme(text=lp.element_text(size=16), title=lp.element_text(size=20))\n", + ")\n", + "\n", + "_LETS_PLOT_DIR = tempfile.mkdtemp(prefix=\"lets-plot-\")\n", + "\n", + "\n", + "def _lets_plot_png(plot):\n", + " \"\"\"Render a Lets-Plot spec to PNG so the cell output carries an image.\"\"\"\n", + " path = ggsave(plot + lp.ggsize(750, 750), \"plot.png\", path=_LETS_PLOT_DIR)\n", + " with open(path, \"rb\") as f:\n", + " return f.read()\n", + "\n", + "\n", + "get_ipython().display_formatter.formatters[\"image/png\"].for_type(\n", + " lp.plot.core.PlotSpec, _lets_plot_png\n", + ")" + ] }, { "cell_type": "code", @@ -291,6 +377,26 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:bar-counts", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "\"\"\"seaborn.objects has no `coord_flip`, so the\n", + "categorical variable is mapped to `y` instead.\n", + "\"\"\"\n", + "(so.Plot(mpg, y=\"manufacturer\")\n", + " .add(so.Bar(), so.Count())\n", + " .label(title=\"Number of Cars by Make\"))" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -423,6 +529,22 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:simple-histogram", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "(so.Plot(mpg, x=\"cty\")\n", + " .add(so.Bars(), so.Hist(binwidth=2)))" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -558,6 +680,26 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "(so.Plot(mpg, x=\"displ\", y=\"hwy\")\n", + " .add(so.Dot())\n", + " .label(\n", + " x=\"Engine Displacement in Liters\",\n", + " y=\"Highway MPG\",\n", + " title=\"Engine Displacement in Liters vs Highway MPG\"))" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -819,6 +961,27 @@ "));" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-colors", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "(so.Plot(mpg, x=\"displ\", y=\"hwy\",\n", + " color=\"class\")\n", + " .add(so.Dot())\n", + " .label(\n", + " x=\"Engine Displacement in Liters\",\n", + " y=\"Highway MPG\",\n", + " title=\"Engine Displacement in Liters vs Highway MPG\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1017,6 +1180,25 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-size", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "(so.Plot(mpg, x=\"cty\", y=\"hwy\",\n", + " pointsize=\"cyl\")\n", + " .add(so.Dots(alpha=.5))\n", + " .scale(pointsize=(4, 12))\n", + " .label(x=\"City MPG\", y=\"Highway MPG\"))" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1085,6 +1267,23 @@ ");" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-facet", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "(so.Plot(mpg, x=\"displ\", y=\"hwy\")\n", + " .add(so.Dot())\n", + " .facet(\"class\", wrap=4))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1211,6 +1410,23 @@ ");" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-facets", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "(so.Plot(mpg, x=\"displ\", y=\"hwy\")\n", + " .add(so.Dot())\n", + " .facet(col=\"cyl\", row=\"drv\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1546,6 +1762,22 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:stacked-bar-chart", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "(so.Plot(diamonds, x=\"cut\", color=\"clarity\")\n", + " .add(so.Bar(), so.Count(), so.Stack()))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1659,6 +1891,22 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:dodged-bar-chart", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "(so.Plot(diamonds, x=\"cut\", color=\"clarity\")\n", + " .add(so.Bar(), so.Count(), so.Dodge()))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1715,6 +1963,27 @@ "outputs": [], "source": "(sns\n .FacetGrid(diamonds, \n hue=\"cut\", \n height=10, \n xlim=(55, 70))\n .map(sns.kdeplot, 'depth', fill=True)\n .add_legend()\n);" }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:stacked-kde", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "\"\"\"`.limit()` only clips the axis; unlike ggplot2's\n", + "`xlim()` it does not drop rows before the density is\n", + "estimated.\n", + "\"\"\"\n", + "(so.Plot(diamonds, x=\"depth\", color=\"cut\")\n", + " .add(so.Area(alpha=.1), so.KDE(gridsize=500))\n", + " .limit(x=(55, 70)))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1901,6 +2170,22 @@ " x=\"date\", y=\"value\"\n", ")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:timeseries", + "package:seaborn-objects" + ] + }, + "outputs": [], + "source": [ + "(so.Plot(ts, x=\"date\", y=\"value\")\n", + " .add(so.Line()))" + ] } ], "metadata": { From 61d6de74fc8d8dfb0a872a00c21fda4717b02428 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 20:39:58 -0400 Subject: [PATCH 30/72] Describe seaborn.objects in the site intro --- INTRO.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/INTRO.md b/INTRO.md index 9398ad4..333bf38 100644 --- a/INTRO.md +++ b/INTRO.md @@ -20,6 +20,8 @@ Many excellent plotting tools are built on top of Matplotlib. "[Seaborn](https://seaborn.pydata.org/ "Seaborn: statistical data visualization") is a Python visualization library based on matplotlib. It provides a high-level interface for drawing attractive statistical graphics." Seaborn makes beautiful plots but is geared toward specific statistical plots, not general purpose plotting. It does have a powerful [faceting utility function](http://seaborn.pydata.org/tutorial/axis_grids.html) that I use regularly. +Seaborn 0.12 added [seaborn.objects](https://seaborn.pydata.org/tutorial/objects_interface.html), a second interface built on the grammar of graphics. It composes a plot from marks and statistical transforms instead of dispatching to a named plotting function, so it covers far more of the examples below than the classic interface does. It has no loess smoother and no regression confidence band, so those two examples are missing. + #### Interactive Plotting Libraries There are several tools that can make the kinds of plots described here. At present, I have little experience with them. If anyone would like to help add examples, please [get in touch](https://github.com/tdhopper/pythonplot.com). From ee856a6ee9e7ded7559d362b3f8f7b822f03f960 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 20:50:36 -0400 Subject: [PATCH 31/72] Add hvPlot (Bokeh) as a comparison package --- Examples.ipynb | 271 ++++++++++++++++++++++++++++++++++ INTRO.md | 2 +- pyproject.toml | 2 + render.py | 1 + tests/test_plots.py | 11 ++ uv.lock | 349 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 635 insertions(+), 1 deletion(-) diff --git a/Examples.ipynb b/Examples.ipynb index bc5e3e9..9533820 100644 --- a/Examples.ipynb +++ b/Examples.ipynb @@ -90,6 +90,72 @@ "\n", "get_ipython().display_formatter.formatters[\"image/png\"].for_type(\n", " lp.plot.core.PlotSpec, _lets_plot_png\n", + ")\n", + "\n", + "import atexit\n", + "import io\n", + "import logging\n", + "\n", + "import holoviews as hv\n", + "import hvplot.pandas # registers the .hvplot accessor on pandas objects\n", + "from bokeh.io.export import get_screenshot_as_png\n", + "from bokeh.models import Plot\n", + "\n", + "hv.extension(\"bokeh\")\n", + "logging.getLogger(\"bokeh.io.export\").setLevel(logging.ERROR)\n", + "hv.plotting.bokeh.ElementPlot.toolbar = None\n", + "hv.plotting.bokeh.ElementPlot.fontscale = 1.6\n", + "\n", + "_bokeh_driver = None\n", + "\n", + "\n", + "def _bokeh_webdriver():\n", + " \"\"\"Headless Chrome for Bokeh's PNG export.\n", + "\n", + " Bokeh screenshots plots through Selenium. Reuse the Chrome for Testing\n", + " build Kaleido already downloads; Selenium Manager supplies the matching\n", + " chromedriver.\n", + " \"\"\"\n", + " global _bokeh_driver\n", + " if _bokeh_driver is None:\n", + " from selenium.webdriver.chrome.options import Options\n", + " from selenium.webdriver.chrome.webdriver import WebDriver as Chrome\n", + "\n", + " options = Options()\n", + " options.add_argument(\"--headless=new\")\n", + " options.add_argument(\"--hide-scrollbars\")\n", + " options.add_argument(\"--force-device-scale-factor=1\")\n", + " options.add_argument(\"--force-color-profile=srgb\")\n", + " options.add_argument(\"--no-sandbox\")\n", + " try:\n", + " from choreographer.browsers.chromium import Chromium\n", + "\n", + " options.binary_location = str(Chromium.find_browser(skip_local=False))\n", + " except Exception: # fall back to whatever Chrome is on the system\n", + " pass\n", + " _bokeh_driver = Chrome(options=options)\n", + " atexit.register(_bokeh_driver.quit)\n", + " return _bokeh_driver\n", + "\n", + "\n", + "def _hvplot_png(obj):\n", + " \"\"\"Render an hvPlot/HoloViews Bokeh figure to PNG for the cell output.\"\"\"\n", + " figure = hv.render(obj, backend=\"bokeh\")\n", + " models = figure.references()\n", + " for model in models:\n", + " if \"toolbar_location\" in model.properties():\n", + " model.toolbar_location = None\n", + " panes = [m for m in models if isinstance(m, Plot)]\n", + " if len(panes) == 1: # leave faceted grids at their per-panel size\n", + " panes[0].width, panes[0].height = 750, 750\n", + " image = get_screenshot_as_png(figure, driver=_bokeh_webdriver())\n", + " buffer = io.BytesIO()\n", + " image.save(buffer, format=\"png\")\n", + " return buffer.getvalue()\n", + "\n", + "\n", + "get_ipython().display_formatter.formatters[\"image/png\"].for_type(\n", + " hv.core.dimension.Dimensioned, _hvplot_png\n", ")" ] }, @@ -397,6 +463,27 @@ " .label(title=\"Number of Cars by Make\"))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:bar-counts", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "\"\"\"hvPlot exposes Bokeh through a `.hvplot`\n", + "accessor that mirrors pandas' own `.plot`.\n", + "\"\"\"\n", + "(mpg[\"manufacturer\"]\n", + " .value_counts(sort=False)\n", + " .hvplot.barh(\n", + " title=\"Number of Cars by Make\"))" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -545,6 +632,21 @@ " .add(so.Bars(), so.Hist(binwidth=2)))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:simple-histogram", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "mpg.hvplot.hist(\"cty\", bins=12)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -700,6 +802,26 @@ " title=\"Engine Displacement in Liters vs Highway MPG\"))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "mpg.hvplot.scatter(\n", + " x=\"displ\", y=\"hwy\",\n", + " xlabel=\"Engine Displacement in Liters\",\n", + " ylabel=\"Highway MPG\",\n", + " title=\"Engine Displacement in Liters \"\n", + " \"vs Highway MPG\")" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1043,6 +1165,22 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-colors", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "mpg.hvplot.scatter(\n", + " x=\"displ\", y=\"hwy\", by=\"class\")" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1199,6 +1337,23 @@ " .label(x=\"City MPG\", y=\"Highway MPG\"))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-size", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "mpg.hvplot.scatter(\n", + " x=\"cty\", y=\"hwy\",\n", + " s=\"cyl\", scale=4, alpha=0.5)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1338,6 +1493,25 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-facet", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "(mpg.hvplot.scatter(\n", + " x=\"displ\", y=\"hwy\", by=\"class\",\n", + " subplots=True, fontscale=0.65,\n", + " width=185, height=185)\n", + " .cols(4))" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1482,6 +1656,27 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:scatter-plot-with-facets", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "\"\"\"`row` and `col` build a HoloViews `GridSpace`,\n", + "which sorts its panels by the facet values.\n", + "\"\"\"\n", + "mpg.hvplot.scatter(\n", + " x=\"displ\", y=\"hwy\",\n", + " row=\"cyl\", col=\"drv\", subplots=True,\n", + " fontscale=0.8, width=230, height=180)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1778,6 +1973,26 @@ " .add(so.Bar(), so.Count(), so.Stack()))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:stacked-bar-chart", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "(diamonds\n", + " .groupby([\"cut\", \"clarity\"])\n", + " .size()\n", + " .unstack()\n", + " .hvplot.bar(stacked=True, rot=45,\n", + " legend=\"top_left\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1907,6 +2122,26 @@ " .add(so.Bar(), so.Count(), so.Dodge()))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:dodged-bar-chart", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "(diamonds\n", + " .groupby([\"cut\", \"clarity\"])\n", + " .size()\n", + " .unstack()\n", + " .hvplot.bar(stacked=False, rot=45,\n", + " legend=\"top_left\"))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -2072,6 +2307,27 @@ "Image(fig.to_image(format=\"png\", width=750, height=750))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:stacked-kde", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "\"\"\"`xlim` only clips the axis. Unlike ggplot2's\n", + "`xlim()` it doesn't drop rows before the\n", + "densities are estimated.\n", + "\"\"\"\n", + "diamonds.hvplot.kde(\n", + " y=\"depth\", by=\"cut\",\n", + " alpha=0.1, xlim=(55, 70))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -2186,6 +2442,21 @@ "(so.Plot(ts, x=\"date\", y=\"value\")\n", " .add(so.Line()))" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "ex", + "name:timeseries", + "package:hvplot" + ] + }, + "outputs": [], + "source": [ + "ts.hvplot.line(x=\"date\", y=\"value\")" + ] } ], "metadata": { diff --git a/INTRO.md b/INTRO.md index 333bf38..8798f06 100644 --- a/INTRO.md +++ b/INTRO.md @@ -33,7 +33,7 @@ There are several tools that can make the kinds of plots described here. At pres "[Lets-Plot](https://lets-plot.org/ "Lets-Plot: an open-source plotting library for statistical data") is an open-source plotting library for statistical data," written by JetBrains and modeled on the grammar of graphics. Its Python API tracks ggplot2 closely enough that most of the examples below translate line for line. I provide Lets-Plot examples rendered as static images. -"[Bokeh](http://bokeh.pydata.org/en/latest/ "Python interactive visualization library") is a Python interactive visualization library that targets modern web browsers for presentation." +"[Bokeh](http://bokeh.pydata.org/en/latest/ "Python interactive visualization library") is a Python interactive visualization library that targets modern web browsers for presentation." The Bokeh examples below go through [hvPlot](https://hvplot.holoviz.org/), which adds an `.hvplot` accessor to data frames that deliberately echoes the pandas `.plot` API, so most of these plots are one call with a few keyword arguments. hvPlot has no regression line or loess smoother, so those two examples are missing. I provide hvPlot examples rendered as static images. "[bqplot](https://github.com/bloomberg/bqplot) is a Grammar of Graphics-based interactive plotting framework for the Jupyter notebook." diff --git a/pyproject.toml b/pyproject.toml index 089edbf..196fdb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,10 +22,12 @@ dependencies = [ "plotly>=5.24", "altair>=5.0", "vl-convert-python>=1.0", # Required for Altair PNG export + "hvplot>=0.12", # Bokeh via the pandas .hvplot accessor # Image rendering "kaleido>=1.0", # v1+ requires Chrome "pillow>=10.0", + "selenium>=4.11", # Required for Bokeh PNG export # Statistical tools "statsmodels>=0.14", diff --git a/render.py b/render.py index a3164ff..8f2dc57 100644 --- a/render.py +++ b/render.py @@ -24,6 +24,7 @@ "plotnine": "plotnine", "lets-plot": "lets-plot", "plotly": "plotly", + "hvplot": "hvplot (Bokeh)", "altair": "Altair", "ggplot": "ggplot2 (R)", } diff --git a/tests/test_plots.py b/tests/test_plots.py index 3a4af40..745bfa4 100644 --- a/tests/test_plots.py +++ b/tests/test_plots.py @@ -4,12 +4,15 @@ defined_plots = { "bar-counts": [ "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "hvplot", ], "dodged-bar-chart": [ "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "hvplot", ], "scatter-plot": [ "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "hvplot", ], "scatter-plot-with-colors": [ "matplotlib", @@ -20,15 +23,19 @@ "ggplot", "plotly", "altair", + "hvplot", ], "scatter-plot-with-facet": [ "seaborn", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "hvplot", ], "scatter-plot-with-facets": [ "seaborn", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "hvplot", ], "scatter-plot-with-size": [ "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "hvplot", ], "scatter-with-regression": [ "seaborn", "plotnine", "lets-plot", "ggplot", "plotly", @@ -42,9 +49,11 @@ "ggplot", "plotly", "altair", + "hvplot", ], "stacked-bar-chart": [ "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "hvplot", ], "stacked-kde": [ "pandas", @@ -55,12 +64,14 @@ "ggplot", "plotly", "altair", + "hvplot", ], "stacked-smooth-line-and-scatter": [ "plotnine", "lets-plot", "ggplot", "plotly", "altair", ], "timeseries": [ "pandas", "seaborn-objects", "plotnine", "lets-plot", "ggplot", "plotly", "altair", + "hvplot", ], } diff --git a/uv.lock b/uv.lock index 1ff7ce9..3a312d4 100644 --- a/uv.lock +++ b/uv.lock @@ -173,6 +173,27 @@ css = [ { name = "tinycss2" }, ] +[[package]] +name = "bokeh" +version = "3.9.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "contourpy" }, + { name = "jinja2" }, + { name = "narwhals" }, + { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, + { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, + { name = "packaging" }, + { name = "pillow" }, + { name = "pyyaml" }, + { name = "tornado", marker = "sys_platform != 'emscripten'" }, + { name = "xyzservices" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/dd/6f/262b649ad2fdd5ed23341452eebfa669a73b0e0c739a369204d02ee2e201/bokeh-3.9.2.tar.gz", hash = "sha256:5be30d105b329d7d2ab1cb92f51e6bd44e23f0fe21ab8d49594b220b2ab11632", size = 5751825, upload-time = "2026-07-25T16:57:56.207Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ca/0c/06a99ee998b1babf95074376cbf6ede5a86af726b12cbf47c4b84fa2803a/bokeh-3.9.2-py3-none-any.whl", hash = "sha256:448e07d5ee78231f5bdece3be020024bb98696c0d6b127e0e2df0b8ba8fa9765", size = 6409477, upload-time = "2026-07-25T16:57:54.62Z" }, +] + [[package]] name = "boto3" version = "1.43.63" @@ -405,6 +426,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, ] +[[package]] +name = "colorcet" +version = "3.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/3f/af/b969f541242b84cbbacabdf20862e487689e352bf0f02f90df2795d29da5/colorcet-3.2.1.tar.gz", hash = "sha256:48d9a67e6e59dc5c0a965aa1b46fe5d59cdc95cc36a95949f29313f950ac59f7", size = 2202958, upload-time = "2026-04-28T16:25:37.43Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1b/24/e95471ae93c08d3606c9c7343cf65d490f154daa88b50581957a0aa780f4/colorcet-3.2.1-py3-none-any.whl", hash = "sha256:3f6fde13cef2169222dd5fe2a2bf847c02d644470fdf167ed566f6421df470f7", size = 262291, upload-time = "2026-04-28T16:25:35.365Z" }, +] + [[package]] name = "comm" version = "0.2.3" @@ -625,6 +655,27 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" }, ] +[[package]] +name = "holoviews" +version = "1.23.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "bokeh" }, + { name = "colorcet" }, + { name = "narwhals" }, + { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, + { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, + { name = "pandas" }, + { name = "panel" }, + { name = "param" }, + { name = "python-dateutil" }, + { name = "pyviz-comms" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f3/1b/f5164c974faa6f629081425609af51613ded4b637e335cd8276a48ed94f9/holoviews-1.23.1.tar.gz", hash = "sha256:97877ee2fcf7bf38ce63f49b731dba75d9b2fcfaf093ca51bd229770a4273cc0", size = 5545288, upload-time = "2026-07-02T13:27:57.327Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ed/b4/3755e3b3f791eefad4131f661ae04eaf70aabd6fc877f41f533e28607a5d/holoviews-1.23.1-py3-none-any.whl", hash = "sha256:43960a6e945aff019816b109873e3088c45c7413f1b679c4dfd1821e2af1a64c", size = 5992415, upload-time = "2026-07-02T13:27:55.295Z" }, +] + [[package]] name = "httpcore" version = "1.0.9" @@ -653,6 +704,26 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" }, ] +[[package]] +name = "hvplot" +version = "0.12.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "bokeh" }, + { name = "colorcet" }, + { name = "holoviews" }, + { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, + { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, + { name = "packaging" }, + { name = "pandas" }, + { name = "panel" }, + { name = "param" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f5/b4/ce73a568fc263efe84cab8de04673949c8f6596f6aeb1531ca2b75b80903/hvplot-0.12.2.tar.gz", hash = "sha256:9e29bbe65f94937d4eeaeccf33566540df936c8f9aeadfa12ea9f306d5237938", size = 7084556, upload-time = "2025-12-18T11:15:37.736Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/11/cd/ec193e471780dfad60e44ded5526c123695c1354910edd537d7aa1d22094/hvplot-0.12.2-py3-none-any.whl", hash = "sha256:0687e2e4d2eeb035c437af0011922abff856054299c121914d903a02b1bb1b22", size = 180626, upload-time = "2025-12-18T11:15:35.091Z" }, +] + [[package]] name = "idna" version = "3.18" @@ -1239,6 +1310,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d9/21/f6fa7129af18153707ffe23aa7a89adc20225e7aa35976f0424e13c6940c/lets_plot-4.11.0-cp314-cp314t-win_amd64.whl", hash = "sha256:366410ddc5e063ca4c1685afd7c0b8f8dcd20946d3abc63d1024c3ef4f706992", size = 6599801, upload-time = "2026-06-30T13:22:40.752Z" }, ] +[[package]] +name = "linkify-it-py" +version = "2.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "uc-micro-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/2e/c9/06ea13676ef354f0af6169587ae292d3e2406e212876a413bf9eece4eb23/linkify_it_py-2.1.0.tar.gz", hash = "sha256:43360231720999c10e9328dc3691160e27a718e280673d444c38d7d3aaa3b98b", size = 29158, upload-time = "2026-03-01T07:48:47.683Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b4/de/88b3be5c31b22333b3ca2f6ff1de4e863d8fe45aaea7485f591970ec1d3e/linkify_it_py-2.1.0-py3-none-any.whl", hash = "sha256:0d252c1594ecba2ecedc444053db5d3a9b7ec1b0dd929c8f1d74dce89f86c05e", size = 19878, upload-time = "2026-03-01T07:48:46.098Z" }, +] + [[package]] name = "logistro" version = "2.0.1" @@ -1257,6 +1340,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/64/69/4a5af2bc115a9a33fefe51709749de8262be3f9ba063d1753a837cdbc49c/markdown-3.10.3-py3-none-any.whl", hash = "sha256:fa6c92a00a4a3c98b22728c64a935ae1928250ae65058a6ded814d2cc29a4cea", size = 110757, upload-time = "2026-07-30T19:05:27.883Z" }, ] +[[package]] +name = "markdown-it-py" +version = "4.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mdurl" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/06/ff/7841249c247aa650a76b9ee4bbaeae59370dc8bfd2f6c01f3630c35eb134/markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49", size = 82454, upload-time = "2026-05-07T12:08:28.36Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/81/4da04ced5a082363ecfa159c010d200ecbd959ae410c10c0264a38cac0f5/markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a", size = 91687, upload-time = "2026-05-07T12:08:27.182Z" }, +] + [[package]] name = "markupsafe" version = "3.0.3" @@ -1408,6 +1503,27 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/41/09/5b161152e2d90f7b87f781c2e1267494aef9c32498df793f73ad0a0a494a/matplotlib_inline-0.2.2-py3-none-any.whl", hash = "sha256:3c821cf1c209f59fb2d2d64abbf5b23b67bcb2210d663f9918dd851c6da1fcf6", size = 9534, upload-time = "2026-05-08T17:33:32.055Z" }, ] +[[package]] +name = "mdit-py-plugins" +version = "0.6.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markdown-it-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/59/fc/f8d0863f8862f25602c0404d75568e89fb6b4109804645e5cdfb1be5cf56/mdit_py_plugins-0.6.1.tar.gz", hash = "sha256:a2bca0f039f39dbd35fb74ae1b5f998608c437463371f0ff7f49a19a17a114d0", size = 56114, upload-time = "2026-05-13T09:03:38.91Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a5/69/6da5581c6a7fede7dc261bf4e67d6adca4196f176b43288b55b3db395b6e/mdit_py_plugins-0.6.1-py3-none-any.whl", hash = "sha256:214c82fb2ac524472ab6a5bcab1de80f73b50443e187f401bfd77efbc7c6481d", size = 66663, upload-time = "2026-05-13T09:03:37.76Z" }, +] + +[[package]] +name = "mdurl" +version = "0.1.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729, upload-time = "2022-08-14T12:40:10.846Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" }, +] + [[package]] name = "mistune" version = "3.3.4" @@ -1507,6 +1623,40 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c5/3c/3179b85b0e1c3659f0369940200cd6d0fa900e6cefcc7ea0bc6dd0e29ffb/nest_asyncio2-1.7.2-py3-none-any.whl", hash = "sha256:f5dfa702f3f81f6a03857e9a19e2ba578c0946a4ad417b4c50a24d7ba641fe01", size = 7843, upload-time = "2026-02-13T00:34:02.691Z" }, ] +[[package]] +name = "nh3" +version = "0.3.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5e/1b/ef84624f14954d270f74060a19fc550dd4f06656399447569afb584d8c06/nh3-0.3.6.tar.gz", hash = "sha256:f3736c9dd3d1856f80cd031715b84ca75cda2bbb1ac802c3da26bfce590838d7", size = 24684, upload-time = "2026-06-22T00:47:02.008Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/99/3e/6506aa4f23dc7b7993a2d0a45dca3ce864ec48380adfe15a173e643c63e8/nh3-0.3.6-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:2411e8c3cee81a1ddd62c2a5d50585c28aa5566d373ad1db92536b95ddb24ef2", size = 1421679, upload-time = "2026-06-22T00:46:20.248Z" }, + { url = "https://files.pythonhosted.org/packages/e3/e1/e96e7864a7a53bd6b6fab7e9632467382a2a2c1f3fed951918ad131542fb/nh3-0.3.6-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e196fa70c2ff2eb4de7d3df3108f8f358c1d69dff20d45b11f20a5aa227ffb6d", size = 792570, upload-time = "2026-06-22T00:46:22.179Z" }, + { url = "https://files.pythonhosted.org/packages/59/62/5b6108bedaef2b2637fed04c87bdbcb5967b9961758b41f0e466ef22a022/nh3-0.3.6-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:34d2b0d934156b87ee114f599a3ba9b8b9e17b5d79652ba3a13fa50903de965e", size = 842243, upload-time = "2026-06-22T00:46:23.801Z" }, + { url = "https://files.pythonhosted.org/packages/4b/4a/526f199626bfcb496bc01a268051b44737962005553b158e985ed7e64865/nh3-0.3.6-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:f2f14b7ae1fca99c4a66c981aac3974e7fbc1ca30a12673d223ae1df76680917", size = 1001468, upload-time = "2026-06-22T00:46:25.481Z" }, + { url = "https://files.pythonhosted.org/packages/49/09/0d8e3101636d9ad88cdefb2914e764cb8e876ebdbb4286bfc251277d9c67/nh3-0.3.6-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:889932a97fb4abb6f95fef1914c0d269ebfb60011e67121c1163059b9449dbb4", size = 1082933, upload-time = "2026-06-22T00:46:27.15Z" }, + { url = "https://files.pythonhosted.org/packages/09/a1/ea83abe738a3fbaa203dfdb836ca7cbab0e7e9609faaee4fe1d4652599c0/nh3-0.3.6-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:edb2b4a1a27523e6cc7c417f8d21ce3d005243548b93e56b762b66b0c7f589f9", size = 1043120, upload-time = "2026-06-22T00:46:28.89Z" }, + { url = "https://files.pythonhosted.org/packages/66/69/0654482b8635012fbae67826bd6c381abb05d841ac7388b9b4666300fdad/nh3-0.3.6-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:43bc1ed3fa0716295fabee29ba42b2667e4a51d140b0a68e092170a765474fa6", size = 1023824, upload-time = "2026-06-22T00:46:30.453Z" }, + { url = "https://files.pythonhosted.org/packages/ed/a6/1f7285ffadc8307c4dbeb08d21b920536d5117785056d1079e998c4dfa44/nh3-0.3.6-cp314-cp314t-win32.whl", hash = "sha256:597a8e843bea00b2eb5520658dc24a9bb032e7fc9e7c2c0c4cd29420220c9796", size = 599253, upload-time = "2026-06-22T00:46:32.072Z" }, + { url = "https://files.pythonhosted.org/packages/36/ea/5542f3c45da4c00290d9d67a65e996702e23e613c4b627de3e09cb9fe357/nh3-0.3.6-cp314-cp314t-win_amd64.whl", hash = "sha256:4713502748f564fee0633b37b3403783ce0a3af3a3d148ad91025a5bdadb7bc6", size = 612553, upload-time = "2026-06-22T00:46:33.53Z" }, + { url = "https://files.pythonhosted.org/packages/66/35/26bd47e6af5915a628281dccdac354ddf4e32f7397047894270acd8c9870/nh3-0.3.6-cp314-cp314t-win_arm64.whl", hash = "sha256:69bbb92865a693d909db3a700d3c01537533844d0948c1e9323561ce06ecda41", size = 595151, upload-time = "2026-06-22T00:46:34.878Z" }, + { url = "https://files.pythonhosted.org/packages/f3/ab/a7653bce9a3b204be6a6931767a9e23595807bb84790ce6685e4d7e5bd08/nh3-0.3.6-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:a43ebd7543555c3ac1bc353023d0794e75cb76f6f18f19c32e95441496c0cc25", size = 1443564, upload-time = "2026-06-22T00:46:36.66Z" }, + { url = "https://files.pythonhosted.org/packages/41/21/e1084ab18eb589506335c7c7576f2d4643e9a0c0e33983ef0e549a256b96/nh3-0.3.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e1b160831c9cdb06a6c79c2f9cdb11386602938f9af260d1c457a85add4f6f69", size = 838002, upload-time = "2026-06-22T00:46:38.101Z" }, + { url = "https://files.pythonhosted.org/packages/b0/94/f48d08e6f72a406300fa11d8acd929fea1a80d4bf750fa292cb10785f126/nh3-0.3.6-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d14bf7982e7a77c0c775634c29c07ce08b38a046df73e1c1f139b3e82f18a38e", size = 823045, upload-time = "2026-06-22T00:46:39.495Z" }, + { url = "https://files.pythonhosted.org/packages/25/bb/431615ba1d1d3eb63cde0f974f2114edf863a8a3f6049a12fed23fc241d3/nh3-0.3.6-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:44673b27010051ab5a5e438a86ec31bbda61d4a77d7e900af6b7be3037c1abae", size = 1093171, upload-time = "2026-06-22T00:46:41.21Z" }, + { url = "https://files.pythonhosted.org/packages/0e/24/a0d80182a18919665fefd19c1c06f1d1df1c9a6455d0252de40c034a0bc3/nh3-0.3.6-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e6b7beece07525dc6e6b0fc2f104442de2ba328360ad00e50cbe2e1fd620447d", size = 1049217, upload-time = "2026-06-22T00:46:42.804Z" }, + { url = "https://files.pythonhosted.org/packages/0a/13/6f1e302ca674ac74362e150848ad56a1be5145391204f74facdb8e94df12/nh3-0.3.6-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:455469a29951edc92bc48b47ac2281c3f2609e6c4f6a047056449f8c2c23facf", size = 917372, upload-time = "2026-06-22T00:46:44.495Z" }, + { url = "https://files.pythonhosted.org/packages/5b/67/314f6151bad77a93d751978a344033e1fc890822f05f0416079338e34231/nh3-0.3.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:905f877dc66dd7aea4a76e54bcb26acb5ff8216f720c0017ccf63e0e6035698e", size = 806699, upload-time = "2026-06-22T00:46:45.99Z" }, + { url = "https://files.pythonhosted.org/packages/3c/a6/bfaa00046e58603507dcfc266c4778e3ab7adf68a5dedd73b6274b8d9314/nh3-0.3.6-cp38-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:25c733bee928530556b1db0ea46c52cf5aa686146e38e60a6fc7cb801ef91cec", size = 835165, upload-time = "2026-06-22T00:46:47.617Z" }, + { url = "https://files.pythonhosted.org/packages/30/a8/fb2c38845efb703a9173bffdfc745fc64d2b0e55cfc73a3647d2f028250c/nh3-0.3.6-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2f90d9a0cfdbee218994fdaaeeb5a0fde62d08f35e4eef0378ec1e2200172fd0", size = 858282, upload-time = "2026-06-22T00:46:49.276Z" }, + { url = "https://files.pythonhosted.org/packages/68/17/06e72a18ee9b572914447338237ca7eb164c0df901f141bc10d1282247a2/nh3-0.3.6-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:82ca5bf427ad1b216b65ede1a2e2d87dc49bec417ceba0f297213107d3cd9d78", size = 1014328, upload-time = "2026-06-22T00:46:51.026Z" }, + { url = "https://files.pythonhosted.org/packages/11/f9/3966c61455668c08853bf5e33b4bed93c421f3194ce4de896dc248d6f6ce/nh3-0.3.6-cp38-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:f5ed5fe84aee7f39db95c214a7421bf0499fbf500fec6d86a4e29bfc37971438", size = 1098207, upload-time = "2026-06-22T00:46:52.674Z" }, + { url = "https://files.pythonhosted.org/packages/19/d3/479cb4ae440424825735d60525b53e3c77fd60fd6e6afc0e984f00eb0178/nh3-0.3.6-cp38-abi3-musllinux_1_2_i686.whl", hash = "sha256:082675ff87b9385ec430ffe6d5847ba7456cc39b73720cd4add472f9f4cffd56", size = 1056961, upload-time = "2026-06-22T00:46:54.335Z" }, + { url = "https://files.pythonhosted.org/packages/17/0c/6cdb5ee1e127be50dc8391e54bddc1f64e87bf4bfad0c55633320e2e02db/nh3-0.3.6-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:36d06341bd501240d320f5942481ed5e6846136b666e1ba4faf802b78ebc875f", size = 1033829, upload-time = "2026-06-22T00:46:56.258Z" }, + { url = "https://files.pythonhosted.org/packages/e9/55/9de666ad975d6ccd77d799ea0add55ee2347aa81286ce21b2a97c070746b/nh3-0.3.6-cp38-abi3-win32.whl", hash = "sha256:5276ef17bdba9ad8040575c74072008b13aae429436e9d0429e718bb5f90f4da", size = 609081, upload-time = "2026-06-22T00:46:57.665Z" }, + { url = "https://files.pythonhosted.org/packages/82/fa/2b5d684e3edf1e81bfd02d298c78c3e3da77ca1d8a2be3183a79544a7548/nh3-0.3.6-cp38-abi3-win_amd64.whl", hash = "sha256:f338ac7d594c067679f1e99b4f5ec3906842979560f9d8f15d6bdfa39a353b10", size = 624461, upload-time = "2026-06-22T00:46:59.163Z" }, + { url = "https://files.pythonhosted.org/packages/7b/e5/7cafee2f0413ca4cb0ef3bd111e94d408a48810008b283ad8aee00dd1809/nh3-0.3.6-cp38-abi3-win_arm64.whl", hash = "sha256:69f365963f63a1e9bff53bdbb3c542c7c2efed3e163c9d5d83a772a2ac468c21", size = 603060, upload-time = "2026-06-22T00:47:00.596Z" }, +] + [[package]] name = "notebook" version = "7.6.1" @@ -1747,6 +1897,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/16/21/5a3f1e8913103b703a436a5664238e5b965ec392b555fe68943ea3691e6b/orjson-3.11.9-cp314-cp314-win_arm64.whl", hash = "sha256:eebdbdeef0094e4f5aefa20dcd4eb2368ab5e7a3b4edea27f1e7b2892e009cf9", size = 126687, upload-time = "2026-05-06T15:11:06.602Z" }, ] +[[package]] +name = "outcome" +version = "1.3.0.post0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/98/df/77698abfac98571e65ffeb0c1fba8ffd692ab8458d617a0eed7d9a8d38f2/outcome-1.3.0.post0.tar.gz", hash = "sha256:9dcf02e65f2971b80047b377468e72a268e15c0af3cf1238e6ff14f7f91143b8", size = 21060, upload-time = "2023-10-26T04:26:04.361Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/55/8b/5ab7257531a5d830fc8000c476e63c935488d74609b50f9384a643ec0a62/outcome-1.3.0.post0-py2.py3-none-any.whl", hash = "sha256:e771c5ce06d1415e356078d3bdd68523f284b4ce5419828922b6871e65eda82b", size = 10692, upload-time = "2023-10-26T04:26:02.532Z" }, +] + [[package]] name = "overrides" version = "7.7.0" @@ -1838,6 +2000,55 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ef/af/4fbc8cab944db5d21b7e2a5b8e9211a03a79852b1157e2c102fcc61ac440/pandocfilters-1.5.1-py2.py3-none-any.whl", hash = "sha256:93be382804a9cdb0a7267585f157e5d1731bbe5545a85b268d6f5fe6232de2bc", size = 8663, upload-time = "2024-01-18T20:08:11.28Z" }, ] +[[package]] +name = "panel" +version = "1.9.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "bokeh" }, + { name = "linkify-it-py" }, + { name = "markdown" }, + { name = "markdown-it-py" }, + { name = "mdit-py-plugins" }, + { name = "narwhals" }, + { name = "nh3" }, + { name = "packaging" }, + { name = "pandas" }, + { name = "panel-material-ui" }, + { name = "param" }, + { name = "pyviz-comms" }, + { name = "requests" }, + { name = "tqdm" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/58/89/65a7eb921a29a203dd0469ada43573108fbb95ad1c83ec947ba32bd3a0f9/panel-1.9.3.tar.gz", hash = "sha256:4d7de30561e31674451ade5f029cddbec6156fd30f3e4cfd7da82f6ecfcbb98f", size = 32215008, upload-time = "2026-06-01T16:02:03.823Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/19/0c/121f4a7d7be7ddbbc9923f3d5c687cb77e3958b2a2e812be69fd76461e4f/panel-1.9.3-py3-none-any.whl", hash = "sha256:46e8d82541b7ae47d2c2393dd746800b95fa7ad8eb545cc39ab5f366ba00a664", size = 30305471, upload-time = "2026-06-01T16:01:59.277Z" }, +] + +[[package]] +name = "panel-material-ui" +version = "0.14.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "bokeh" }, + { name = "packaging" }, + { name = "panel" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/24/cf/09318155fbfaf7236afeea41d62f76b1e993b10b0bb1141d9e3e0cb32f0d/panel_material_ui-0.14.1.tar.gz", hash = "sha256:709827337c39eb6ebc40fbd0297ebb7c8e8e104be11defac5c22e4323d4ccefa", size = 3988677, upload-time = "2026-07-29T12:13:15.157Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c7/0c/abb3ef5fb41dd87f1a5cb8fc380ecdc609614d97c9b28d5f2073342ebbf0/panel_material_ui-0.14.1-py3-none-any.whl", hash = "sha256:00c4c0956f401dcf0c7a468c8705a3e883e0c442061d13c015321cb82035801b", size = 1730907, upload-time = "2026-07-29T12:13:12.554Z" }, +] + +[[package]] +name = "param" +version = "2.4.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/79/9d/33f32981c9cda89fe22abff60f7c71ef4af3e566b6af530392f8b938470d/param-2.4.1.tar.gz", hash = "sha256:364a33bd8a968b053d8a49d319af78dc31b3ccb9661ecb95c29a3ea509d7e443", size = 217776, upload-time = "2026-06-09T13:17:33.665Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ac/37/1351bbfabbacbe92cd38774f8779ff680fab48c36b5fed9bcfe0c160009c/param-2.4.1-py3-none-any.whl", hash = "sha256:6cdc0869b3ade232fc6d01691223cf86c2bdb53a6d5ba67a33dba838d8b8cf4c", size = 151874, upload-time = "2026-06-09T13:17:31.996Z" }, +] + [[package]] name = "parso" version = "0.8.7" @@ -2141,6 +2352,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/3e/b9/3766cc361d93edb2ce81e2e1f87dd98f314d7d513877a342d31b30741680/pypng-0.20220715.0-py3-none-any.whl", hash = "sha256:4a43e969b8f5aaafb2a415536c1a8ec7e341cd6a3f957fd5b5f32a4cfeed902c", size = 58057, upload-time = "2022-07-15T14:11:03.713Z" }, ] +[[package]] +name = "pysocks" +version = "1.7.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/bd/11/293dd436aea955d45fc4e8a35b6ae7270f5b8e00b53cf6c024c83b657a11/PySocks-1.7.1.tar.gz", hash = "sha256:3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0", size = 284429, upload-time = "2019-09-20T02:07:35.714Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/8d/59/b4572118e098ac8e46e399a1dd0f2d85403ce8bbaad9ec79373ed6badaf9/PySocks-1.7.1-py3-none-any.whl", hash = "sha256:2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5", size = 16725, upload-time = "2019-09-20T02:06:22.938Z" }, +] + [[package]] name = "pytest" version = "9.1.1" @@ -2185,6 +2405,7 @@ source = { virtual = "." } dependencies = [ { name = "altair" }, { name = "boto3" }, + { name = "hvplot" }, { name = "ipython" }, { name = "jinja2" }, { name = "jinja2-highlight" }, @@ -2204,6 +2425,7 @@ dependencies = [ { name = "rpy2" }, { name = "scikit-misc" }, { name = "seaborn" }, + { name = "selenium" }, { name = "simplegeneric" }, { name = "statsmodels", version = "0.14.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and sys_platform == 'emscripten'" }, { name = "statsmodels", version = "0.14.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12' or sys_platform != 'emscripten'" }, @@ -2215,6 +2437,7 @@ dependencies = [ requires-dist = [ { name = "altair", specifier = ">=5.0" }, { name = "boto3", specifier = ">=1.28" }, + { name = "hvplot", specifier = ">=0.12" }, { name = "ipython", specifier = ">=8.12" }, { name = "jinja2", specifier = ">=3.1" }, { name = "jinja2-highlight", specifier = ">=0.6" }, @@ -2233,6 +2456,7 @@ requires-dist = [ { name = "rpy2", specifier = ">=3.5" }, { name = "scikit-misc", specifier = ">=0.3" }, { name = "seaborn", specifier = ">=0.13" }, + { name = "selenium", specifier = ">=4.11" }, { name = "simplegeneric", specifier = ">=0.8" }, { name = "statsmodels", specifier = ">=0.14" }, { name = "tzlocal", specifier = ">=5.0" }, @@ -2242,6 +2466,18 @@ requires-dist = [ [package.metadata.requires-dev] dev = [] +[[package]] +name = "pyviz-comms" +version = "3.0.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "param" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/da/ee/2b5367b911bab506662abffe6f342101a9b3edacee91ff9afe62db5fe9a7/pyviz_comms-3.0.6.tar.gz", hash = "sha256:73d66b620390d97959b2c4d8a2c0778d41fe20581be4717f01e46b8fae8c5695", size = 197772, upload-time = "2025-06-20T16:50:30.97Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/13/5a/f8c0868199bbb231a02616286ce8a4ccb85f5387b9215510297dcfedd214/pyviz_comms-3.0.6-py3-none-any.whl", hash = "sha256:4eba6238cd4a7f4add2d11879ce55411785b7d38a7c5dba42c7a0826ca53e6c2", size = 84275, upload-time = "2025-06-20T16:50:28.826Z" }, +] + [[package]] name = "pywinpty" version = "3.0.5" @@ -2799,6 +3035,23 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/83/11/00d3c3dfc25ad54e731d91449895a79e4bf2384dc3ac01809010ba88f6d5/seaborn-0.13.2-py3-none-any.whl", hash = "sha256:636f8336facf092165e27924f223d3c62ca560b1f2bb5dff7ab7fad265361987", size = 294914, upload-time = "2024-01-25T13:21:49.598Z" }, ] +[[package]] +name = "selenium" +version = "4.46.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "trio" }, + { name = "trio-websocket" }, + { name = "typing-extensions" }, + { name = "urllib3", extra = ["socks"] }, + { name = "websocket-client" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a0/53/053df98ef0c38535a74ea732217eb2dbfddc7ff5442a47a4b315ba577f85/selenium-4.46.0.tar.gz", hash = "sha256:54f7e1a4df5f7508ac8c38ce2ea584db1b27083dd79962b22524219219df5cbe", size = 1006000, upload-time = "2026-07-11T00:38:41.11Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/30/f4/365c723a37c7e9ba6a6a19bf0c9e407137703f56a72c6201d0e4cb1432cb/selenium-4.46.0-py3-none-any.whl", hash = "sha256:f03e864770a21ab32009961c9d015cb2c6275eba45c926c272e02d90af423aad", size = 9428587, upload-time = "2026-07-11T00:38:38.84Z" }, +] + [[package]] name = "send2trash" version = "2.1.0" @@ -2887,6 +3140,24 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" }, ] +[[package]] +name = "sniffio" +version = "1.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372, upload-time = "2024-02-25T23:20:04.057Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235, upload-time = "2024-02-25T23:20:01.196Z" }, +] + +[[package]] +name = "sortedcontainers" +version = "2.4.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e8/c4/ba2f8066cceb6f23394729afe52f3bf7adec04bf9ed2c820b39e19299111/sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88", size = 30594, upload-time = "2021-05-16T22:03:42.897Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/32/46/9cb0e58b2deb7f82b84065f37f3bffeb12413f947f9388e4cac22c4621ce/sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0", size = 29575, upload-time = "2021-05-16T22:03:41.177Z" }, +] + [[package]] name = "soupsieve" version = "2.9.1" @@ -3020,6 +3291,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/71/2e/7b1c769803121b809112cf9a00681c472eae1d80e32d7ec0e0bd61d0d0e1/tornado-6.5.7-cp39-abi3-win_arm64.whl", hash = "sha256:ff934fce95643af5f11efdae618eaa73d469dc588641e5c8d19295a0c65c4796", size = 450506, upload-time = "2026-06-08T17:34:49.702Z" }, ] +[[package]] +name = "tqdm" +version = "4.70.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/21/3b/6c24bec5be5e743ffd99576daa5cc077722fc7d5bbc00bd133fa0c698dc6/tqdm-4.70.0.tar.gz", hash = "sha256:55b0b0dbd97462d06ebee91e4dac24ed4d4702be82b24f07e6c1d27e08cea220", size = 795438, upload-time = "2026-07-27T11:33:15.271Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f9/1c/01bfd571a64e7f270e6bab5e33777debe0edc56759233ce84f27dec92d14/tqdm-4.70.0-py3-none-any.whl", hash = "sha256:7f585706bfddbdebf89daac705b2dfcc16890130727d3197ca62c732b4310953", size = 80184, upload-time = "2026-07-27T11:33:13.167Z" }, +] + [[package]] name = "traitlets" version = "5.16.1" @@ -3029,6 +3312,37 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ad/66/0d785f0bc5e4315a96c989bb476d0fc07ea4f85132550c7b156ca2035d52/traitlets-5.16.1-py3-none-any.whl", hash = "sha256:f775618166caa0396c8e337099240f2bd3e5e917d203b2e6fbe21a58d3cb1f6b", size = 86211, upload-time = "2026-08-03T08:32:34.48Z" }, ] +[[package]] +name = "trio" +version = "0.33.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "cffi", marker = "implementation_name != 'pypy' and os_name == 'nt'" }, + { name = "idna" }, + { name = "outcome" }, + { name = "sniffio" }, + { name = "sortedcontainers" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/52/b6/c744031c6f89b18b3f5f4f7338603ab381d740a7f45938c4607b2302481f/trio-0.33.0.tar.gz", hash = "sha256:a29b92b73f09d4b48ed249acd91073281a7f1063f09caba5dc70465b5c7aa970", size = 605109, upload-time = "2026-02-14T18:40:55.386Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1c/93/dab25dc87ac48da0fe0f6419e07d0bfd98799bed4e05e7b9e0f85a1a4b4b/trio-0.33.0-py3-none-any.whl", hash = "sha256:3bd5d87f781d9b0192d592aef28691f8951d6c2e41b7e1da4c25cde6c180ae9b", size = 510294, upload-time = "2026-02-14T18:40:53.313Z" }, +] + +[[package]] +name = "trio-websocket" +version = "0.12.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "outcome" }, + { name = "trio" }, + { name = "wsproto" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d1/3c/8b4358e81f2f2cfe71b66a267f023a91db20a817b9425dd964873796980a/trio_websocket-0.12.2.tar.gz", hash = "sha256:22c72c436f3d1e264d0910a3951934798dcc5b00ae56fc4ee079d46c7cf20fae", size = 33549, upload-time = "2025-02-25T05:16:58.947Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c7/19/eb640a397bba49ba49ef9dbe2e7e5c04202ba045b6ce2ec36e9cadc51e04/trio_websocket-0.12.2-py3-none-any.whl", hash = "sha256:df605665f1db533f4a386c94525870851096a223adcb97f72a07e8b4beba45b6", size = 21221, upload-time = "2025-02-25T05:16:57.545Z" }, +] + [[package]] name = "typing-extensions" version = "4.16.0" @@ -3059,6 +3373,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/9e/a4/017a7a6cbe387d961a688ec31364ae60a5c4e22c96ae9921b79a947c855d/tzlocal-5.4.4-py3-none-any.whl", hash = "sha256:aae09f0126a8a86fa736be266eb4a471380d26a0de3bc14844e7821fee3e2a15", size = 18115, upload-time = "2026-06-29T08:03:38.666Z" }, ] +[[package]] +name = "uc-micro-py" +version = "2.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/78/67/9a363818028526e2d4579334460df777115bdec1bb77c08f9db88f6389f2/uc_micro_py-2.0.0.tar.gz", hash = "sha256:c53691e495c8db60e16ffc4861a35469b0ba0821fe409a8a7a0a71864d33a811", size = 6611, upload-time = "2026-03-01T06:31:27.526Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/61/73/d21edf5b204d1467e06500080a50f79d49ef2b997c79123a536d4a17d97c/uc_micro_py-2.0.0-py3-none-any.whl", hash = "sha256:3603a3859af53e5a39bc7677713c78ea6589ff188d70f4fee165db88e22b242c", size = 6383, upload-time = "2026-03-01T06:31:26.257Z" }, +] + [[package]] name = "uri-template" version = "1.3.0" @@ -3077,6 +3400,11 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7f/3e/5db95bcf282c52709639744ca2a8b149baccf648e39c8cc87553df9eae0c/urllib3-2.7.0-py3-none-any.whl", hash = "sha256:9fb4c81ebbb1ce9531cce37674bbc6f1360472bc18ca9a553ede278ef7276897", size = 131087, upload-time = "2026-05-07T16:13:17.151Z" }, ] +[package.optional-dependencies] +socks = [ + { name = "pysocks" }, +] + [[package]] name = "vl-convert-python" version = "1.9.0.post1" @@ -3134,3 +3462,24 @@ sdist = { url = "https://files.pythonhosted.org/packages/bd/f4/c67440c7fb409a71b wheels = [ { url = "https://files.pythonhosted.org/packages/3f/0e/fa3b193432cfc60c93b42f3be03365f5f909d2b3ea410295cf36df739e31/widgetsnbextension-4.0.15-py3-none-any.whl", hash = "sha256:8156704e4346a571d9ce73b84bee86a29906c9abfd7223b7228a28899ccf3366", size = 2196503, upload-time = "2025-11-01T21:15:53.565Z" }, ] + +[[package]] +name = "wsproto" +version = "1.3.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "h11" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c7/79/12135bdf8b9c9367b8701c2c19a14c913c120b882d50b014ca0d38083c2c/wsproto-1.3.2.tar.gz", hash = "sha256:b86885dcf294e15204919950f666e06ffc6c7c114ca900b060d6e16293528294", size = 50116, upload-time = "2025-11-20T18:18:01.871Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a4/f5/10b68b7b1544245097b2a1b8238f66f2fc6dcaeb24ba5d917f52bd2eed4f/wsproto-1.3.2-py3-none-any.whl", hash = "sha256:61eea322cdf56e8cc904bd3ad7573359a242ba65688716b0710a5eb12beab584", size = 24405, upload-time = "2025-11-20T18:18:00.454Z" }, +] + +[[package]] +name = "xyzservices" +version = "2026.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/08/3cb9f67a8d48021aca2a02292cc26eecd71d949ae70ad66420a8730cc302/xyzservices-2026.3.0.tar.gz", hash = "sha256:d226866a5d8e9fef337034d8da37a8298f0a1d9d1489b4018e69579eb321fea4", size = 1135736, upload-time = "2026-03-30T14:42:25.596Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a8/a9/d23012099dc88ec69a29c6407b41d89681cb674c2043cd5b467c7e299c08/xyzservices-2026.3.0-py3-none-any.whl", hash = "sha256:503183d4b322bfebc3c50cdd21192aa3e81e36c5efbf9133d54ae82143e0576b", size = 94101, upload-time = "2026-03-30T14:42:24.608Z" }, +] From b5168a8e68023e0972ae59411b42affd5c4e1cd9 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 20:56:16 -0400 Subject: [PATCH 32/72] Tune hvPlot dodged bars and harden the Bokeh webdriver lookup --- CLAUDE.md | 1 + Examples.ipynb | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 490136a..d725ba4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -95,6 +95,7 @@ All plots are rendered to static PNG images inside the executed notebook: - **Plotly**: `pio.renderers.default = "png"` with Kaleido (needs Chrome; `uv run kaleido_get_chrome`) - **Altair**: `alt.renderers.enable("png")` with vl-convert-python (set in the notebook's first cell — do not remove) - **R/ggplot2**: rpy2 against the system R installation (`%%R` cell magic) +- **Lets-Plot** and **hvPlot/Bokeh**: an `image/png` IPython formatter registered in the notebook's first cell. Bokeh has no headless renderer, so hvPlot figures are screenshotted through Selenium driving the same Chrome for Testing build Kaleido downloads; Selenium Manager fetches the matching chromedriver on first use (needs network). ## Adding New Plots diff --git a/Examples.ipynb b/Examples.ipynb index 9533820..ee51a95 100644 --- a/Examples.ipynb +++ b/Examples.ipynb @@ -131,9 +131,10 @@ " from choreographer.browsers.chromium import Chromium\n", "\n", " options.binary_location = str(Chromium.find_browser(skip_local=False))\n", + " _bokeh_driver = Chrome(options=options)\n", " except Exception: # fall back to whatever Chrome is on the system\n", - " pass\n", - " _bokeh_driver = Chrome(options=options)\n", + " options.binary_location = \"\"\n", + " _bokeh_driver = Chrome(options=options)\n", " atexit.register(_bokeh_driver.quit)\n", " return _bokeh_driver\n", "\n", @@ -2138,8 +2139,8 @@ " .groupby([\"cut\", \"clarity\"])\n", " .size()\n", " .unstack()\n", - " .hvplot.bar(stacked=False, rot=45,\n", - " legend=\"top_left\"))" + " .hvplot.bar(stacked=False, rot=90,\n", + " fontscale=0.9))" ] }, { From 8a3848bde4bee36e8338393d379d989df1794b6b Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 21:18:50 -0400 Subject: [PATCH 33/72] Add weekly scheduled build and Dependabot updates for uv lockfile The scheduled run exercises the full build without deploying (deploy steps are push-gated), so a breaking library release shows up as a red badge within a week instead of silently rotting. Dependabot groups Python bumps into one weekly PR that CI proves out. --- .github/dependabot.yml | 13 +++++++++++++ .github/workflows/deploy.yml | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0c01be5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "uv" + directory: "/" + schedule: + interval: "weekly" + groups: + python-dependencies: + patterns: ["*"] + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f75a3e2..da697eb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,6 +5,10 @@ on: branches: ['**'] pull_request: branches: [master] + schedule: + # Weekly build-health check; deploy steps only run on push events, + # so this catches library breakage without touching production. + - cron: '0 6 * * 1' jobs: build-and-deploy: From 32f4db59787b5e5f3c3fb4d2cb0c2d5246f5f837 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 21:26:10 -0400 Subject: [PATCH 34/72] Write plot images as WebP instead of PNG Plots are exported at ~1500x1500, and the page now ships 100+ of them. Re-encoding the notebook's PNG output as quality-85 WebP cuts the image payload from 8.5 MB to 2.6 MB with no visible loss. Filenames keep the MD5-of-base64 scheme so unchanged plots keep their URLs. image_from_cell now also returns the pixel dimensions, which the template uses to reserve layout space. --- render.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/render.py b/render.py index 8f2dc57..3864f1a 100644 --- a/render.py +++ b/render.py @@ -11,6 +11,8 @@ import subprocess import base64 import hashlib +import io +from PIL import Image logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') @@ -49,18 +51,29 @@ intro = f.read() +WEBP_QUALITY = 85 + + def image_from_cell(cell): + """Save the cell's PNG output as WebP and return its path and pixel size. + + The filename stays the MD5 of the base64 PNG, so a plot that hasn't changed + keeps its URL. The pixel size lets the template declare width/height, which + reserves layout space for the lazily loaded images. + """ try: for c in cell['outputs']: if 'data' in c and 'image/png' in c['data']: base64_img = c['data']['image/png'].replace("\n", "").strip() filename = hashlib.md5() filename.update(base64_img.encode('ascii')) - web_path = "/img/plots/{}.png".format(filename.hexdigest()) + web_path = "/img/plots/{}.webp".format(filename.hexdigest()) full_path = "web" + web_path - with open(full_path, "wb") as fh: - fh.write(base64.b64decode(base64_img)) - return web_path + image = Image.open(io.BytesIO(base64.b64decode(base64_img))) + if image.mode not in ("RGB", "RGBA"): + image = image.convert("RGBA") + image.save(full_path, "WEBP", quality=WEBP_QUALITY, method=6) + return {"path": web_path, "width": image.width, "height": image.height} except KeyError as e: logging.error("Can't find image in cell: %s", cell['source']) raise e @@ -145,7 +158,9 @@ def extract_cells(path): "cell_num": cell_num, "package": packages.get(tags["package"], tags["package"]), "package-slug": tags['package'], - "image": image, + "image": image["path"], + "image-width": image["width"], + "image-height": image["height"], "content": source, "comment": md.convert(comment) or None, }) From a82d8352e1c52037044bcafcba25c853d53e12c7 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 21:26:27 -0400 Subject: [PATCH 35/72] Lazy-load plot images and reserve their layout space Every plot image but the first one now loads lazily and decodes off the main thread, so a visit only fetches what the reader scrolls to. The width/height attributes come from the rendered image, which keeps the cards from collapsing and reflowing as images arrive. Also adds alt text, which the images never had. --- templates/t_index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/t_index.html b/templates/t_index.html index f1aa2a6..db18810 100644 --- a/templates/t_index.html +++ b/templates/t_index.html @@ -107,6 +107,7 @@
{{ name }}

{% for (name, slug), items in plots.items() %} + {% set outer_loop = loop %}
@@ -124,12 +125,13 @@

{% for plot in items %} + {% set eager = outer_loop.first and loop.first %}
From c502cf5b31f58514ba1a80c5df9257a7b67af51e Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 21:26:46 -0400 Subject: [PATCH 36/72] Add a copy button to each code panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The whole point of the site is lifting a snippet into your own notebook, which until now meant selecting the pygments markup by hand. One delegated click handler covers all 101 panels and falls back to a "Press ⌘C" hint where the clipboard API is unavailable. Also drops the $.bigfoot() call: the library was never loaded, so it threw on every page load. --- templates/t_index.html | 30 ++++++++++++++++++++++++++++-- web/css/custom.css | 21 +++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/templates/t_index.html b/templates/t_index.html index db18810..36e4405 100644 --- a/templates/t_index.html +++ b/templates/t_index.html @@ -135,7 +135,10 @@

-
Code:
+
+
Code:
+ +
{% if plot['package'] == "ggplot" %} {% highlight 'R' %}{{ plot['content'] }}{% endhighlight %} {% else %} @@ -181,7 +184,30 @@
Note:
event.preventDefault(); $(this).ekkoLightbox({alwaysShowClose: true}); }); - $.bigfoot(); + + + diff --git a/web/css/custom.css b/web/css/custom.css index 4e16bcd..2ea21e6 100644 --- a/web/css/custom.css +++ b/web/css/custom.css @@ -27,6 +27,27 @@ table { font-family: monospace; } +/* Copy button sitting in the dark code panel header. */ +.copy-btn { + background: transparent; + border: 1px solid #4a4a4a; + border-radius: 3px; + color: #9a9a9a; + cursor: pointer; + font-size: .75rem; + line-height: 1.2; + min-width: 4.5rem; + padding: .15rem .5rem; + transition: color .15s ease, border-color .15s ease; +} + +.copy-btn:hover, +.copy-btn:focus { + border-color: #7a7a7a; + color: #e6e6e6; + outline: none; +} + @media (min-width: 1600px) { .container { width: 1440px; From 5df89ade795ca73e986c271dfee989545774cfc0 Mon Sep 17 00:00:00 2001 From: Tim Hopper Date: Tue, 4 Aug 2026 21:27:01 -0400 Subject: [PATCH 37/72] Give each plot heading a visible anchor link The heading already carried a deep link, but it was a Font Awesome icon and Font Awesome is not loaded, so it rendered as nothing. A muted # after the title is visible without competing with the heading. --- templates/t_index.html | 2 +- web/css/custom.css | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/templates/t_index.html b/templates/t_index.html index 36e4405..88130fe 100644 --- a/templates/t_index.html +++ b/templates/t_index.html @@ -111,7 +111,7 @@
{{ name }}
-

{{ name }}

+

{{ name }}#