Add 3D/embed/perf features#18
Merged
Merged
Conversation
Major additions across rendering, embedding, and performance: Rendering & plot types - True-colour RGB imshow ((H,W,3|4) arrays) - 3D voxels geometry + draggable PlaneWidget slice selectors - scatter3d per-point colours, set_highlight, reference sphere, bounds - Turntable 3D camera (matplotlib azim/elev; reaches any viewpoint) - Mini-TeX label formatting (superscripts/Greek/symbols) + fontsize control - IPF and voxel-grain explorer examples; label-formatting example Embedding (no Jupyter required) - anyplotlib.embed: figure_state/to_html/save_html/esm_path + FigureBridge - figure_esm.js mount() API for Electron / plain web pages - docs/embedding.rst guide WebGPU (progressive enhancement, canvas fallback) - Instanced points + voxels on the GPU via gpu="auto"; airtight Canvas2D fallback (no navigator.gpu / null adapter / device loss). No JS deps. - Hardware-verified on NVIDIA Pascal; WEBGPU_PLAN.md tracks phases. Performance (smoothness under Pyodide) - Figure.batch() coalesces panel pushes (one per panel per frame) - Geometry channel: heavy buffers ride a separate hash-gated trait, re-sent only on change — view updates (highlight/camera/planes) no longer retransmit geometry. Voxel explorer per-frame traffic -65%. - Voxel sprite cache + typed-array projection; RGB imshow skips LUT rebuild Packaging - LICENSE (MIT), wheel excludes tests/baselines, py3.13 classifier - RELEASE_PLAN.md; committed uv.lock Tests: +~90 across labels, embed, RGB, voxels/planes, GPU fallback, batch, geometry channel. Full suite 1323 passed / 58 skipped.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #18 +/- ##
==========================================
- Coverage 90.84% 90.62% -0.22%
==========================================
Files 31 33 +2
Lines 2501 2741 +240
==========================================
+ Hits 2272 2484 +212
- Misses 229 257 +28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The default 11px bold 2D title was drawn strip-tight (12px strip, centered), leaving ~0px top margin. macOS Chromium hints fonts ~1px taller than the Windows dev box, so on macOS CI the title ascender reached row 0 of the title canvas and test_no_clipping flagged it as clipped. Clamp the drawn title size to padT-4 (reserve ~4px total vertical margin). Since _padT grows for large/TeX titles, this only affects the 12px default strip, capping an 11px title to ~8px — a sub-pixel change well within the visual-regression tolerance (all 24 baselines still match). Now ~2px top and bottom margin on the dev box, which absorbs the cross-platform hinting variance.
Self-review of the geometry channel found two cleanups: - Figure._push hashed (md5 of a 346 KB json.dumps) the geometry blob on EVERY push to detect change — ~1.4 ms of pure CPU per view-only frame just to discover nothing changed, partly undercutting the transfer win. Replace with a direct equality check against the last-sent geom dict: the b64 strings are the same objects when unchanged, so equality short-circuits (~0.05 ms/call, 28x faster) and no serialise happens until geometry really changes. Drops the now-unused hashlib import; renames _geom_hash -> _geom_last. - _applyGeom had a dead if/else (both branches identical). Collapse to a single "apply cache when present" with a clearer comment. No behaviour change; full suite 1323 passed / 58 skipped.
d9c8ef5 to
e41b905
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Major additions across rendering, embedding, and performance:
Rendering & plot types
Embedding (no Jupyter required)
WebGPU (progressive enhancement, canvas fallback)
Performance (smoothness under Pyodide)
Packaging
Tests: +~90 across labels, embed, RGB, voxels/planes, GPU fallback, batch, geometry channel. Full suite 1323 passed / 58 skipped.