Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,14 @@ docs/_static/anywidget_config.js

# Generated by Sphinx-Gallery (anywidget iframe HTML) — never commit
docs/_static/viewer_widgets/

# Scratch doc builds (`make html O=...` into a throwaway output dir)
docs/_dummy/

# Scratch working files that land in the repo root / Examples during
# development: saved diffs and throwaway notebooks. Real examples are
# `Examples/<Section>/plot_*.py` and are picked up by Sphinx-Gallery.
*.diff
*.patch
Examples/testing.ipynb
Examples/*.ipynb
27 changes: 25 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- **`Figure`** (`anyplotlib/figure/_figure.py`) — the only `anywidget.AnyWidget` subclass. Owns all traitlets and is the Python↔JS bridge.
- **Plot objects** (`plot1d/`, `plot2d/`, `plot3d/`) — `Plot1D`, `PlotBar`, `Plot2D`, `PlotMesh`, `Plot3D` are **plain Python classes**, not widgets. They hold state in `_state` dicts and push to the Figure. Shared behaviour lives in `_base_plot.py` (`_BasePlot`, `_PanelMixin`, `_MarkerMixin`).
- **`Axes`** (`axes/_axes.py`) — grid-cell container; factory methods (`imshow`, `plot`, `bar`, `pcolormesh`, `plot_surface`, …) create plot objects and attach them.
- **`figure_esm.js`** — pure-JS canvas renderer (~4,400 lines); all rendering logic lives here. **Read `anyplotlib/FIGURE_ESM.md` first** — it is the section map.
- **`figure_esm.js`** — pure-JS canvas renderer (~9,300 lines); all rendering logic lives here. **Read `anyplotlib/FIGURE_ESM.md` first** — it is the section map.
- **`markers.py`** — static visual overlays (circles, arrows, lines, etc.) with a two-level dict registry: `plot.markers[type][name]`.
- **`widgets/`** — interactive draggable overlays (`RectangleWidget`, `CrosshairWidget`, etc.) that receive JS position updates.
- **`callbacks.py`** — event system: `Event` dataclass, `CallbackRegistry` (priority ordering, wildcard, pause/hold), `_EventMixin` (`add_event_handler`).
Expand Down Expand Up @@ -95,8 +95,31 @@ make html
make clean # wipe build artefacts
```

**After editing `figure_esm.js`, docs need `make clean` first.** Sphinx Gallery
re-executes an example only when its *source* MD5 changes, and each example's
interactive widget page (`build/html/_static/viewer_widgets/*.html`, ~1 MB) is
generated during that execution with the renderer **inlined**. A plain
`make html` therefore rebuilds the pages and the Pyodide wheel but silently
serves widgets built from an older `figure_esm.js` — the figures still work,
so nothing looks broken; they just behave like the old renderer. Check with
`grep -c '<some new symbol>' build/html/_static/viewer_widgets/<page>_001.html`
when a JS change doesn't seem to reach the docs.

**Any insertion into `figure_esm.js` shifts every `FIGURE_ESM.md` line anchor
below it.** The anchors are maintained by hand, so re-check them in the *same*
commit that moves them — a map that is 500 lines out is worse than no map. Dump
the real numbers with:

```bash
grep -nE '^\s*(function|const|let) [A-Za-z_]' anyplotlib/figure_esm.js
```

and reconcile against the two numbered tables (the section map near the top and
the 2-D function table). Both were last verified at 9,285 lines.

Changelog entries: add a fragment file to `upcoming_changes/` (e.g.
`123.new_feature.rst`) — towncrier assembles `CHANGELOG.rst` at release time.
Use `api_change` when existing behaviour changes, even if the change is a fix.

## Key Files

Expand All @@ -106,7 +129,7 @@ Changelog entries: add a fragment file to `upcoming_changes/` (e.g.
| `anyplotlib/figure/_gridspec.py` | `GridSpec`, `SubplotSpec` |
| `anyplotlib/figure/_subplots.py` | `subplots()` factory |
| `anyplotlib/axes/_axes.py` | `Axes` — plot factory methods |
| `anyplotlib/figure_esm.js` | All JS canvas rendering (~4,400 lines) |
| `anyplotlib/figure_esm.js` | All JS canvas rendering (~9,300 lines) |
| `anyplotlib/FIGURE_ESM.md` | Section map for `figure_esm.js` — read this before editing the JS |
| `anyplotlib/markers.py` | Static marker collections; `to_wire()` translation |
| `anyplotlib/widgets/` | Interactive overlay widgets |
Expand Down
341 changes: 341 additions & 0 deletions Examples/Interactive/plot_star_globe_explorer.py

Large diffs are not rendered by default.

Loading
Loading