Skip to content

Exact pixel value in the 2-D hover readout - #68

Merged
CSSFrancis merged 1 commit into
mainfrom
feat/pixel-readout
Sep 4, 2026
Merged

Exact pixel value in the 2-D hover readout#68
CSSFrancis merged 1 commit into
mainfrom
feat/pixel-readout

Conversation

@CSSFrancis

@CSSFrancis CSSFrancis commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Exact Pixel Readout.

The 2-D hover readout named the physical and pixel coordinates but not the value. This is a bit of an involved change but good overall.

Implementation

v:<value> for a colourmapped image, rgb:r,g,b for a true-color one,
alongside the existing coordinates.

@codecov-commenter

codecov-commenter commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.27273% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.85%. Comparing base (87e7fa3) to head (145e0ee).

Files with missing lines Patch % Lines
anyplotlib/plot2d/_plot2d.py 84.44% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
- Coverage   90.90%   90.85%   -0.05%     
==========================================
  Files          40       40              
  Lines        4550     4603      +53     
==========================================
+ Hits         4136     4182      +46     
- Misses        414      421       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The hover readout named the physical and pixel coordinates but not the value,
which is usually the number a viewer is after. It now shows `v:<value>` for a
colourmapped image and `rgb:r,g,b` for a true-colour one.

The value is exact rather than inferred from the transferred byte wherever it
can be. Integer data whose range fits inside the 256 quantised codes is
inverted locally; anything wider is answered by Python once the cursor has
dwelled on a pixel (`probe_exact=True` by default, tunable through
`Plot2D.set_value_probe`), and the quantised estimate is the fallback when no
kernel can answer — which is what a `save_html` page always shows. Zoomed in
past a detail tile the value is read from the tile's native pixels rather than
the coarser overview underneath, so the readout always names the source
actually on screen.

The `v` key toggles the on-image pill. `Plot2D.set_readout_visible` hides it
from Python while keeping the readout live, so an embedding host can render
position and value in its own chrome instead: every update arrives through
`mount()`'s `opts.onReadout` and as an `apl:readout` DOM event. 2-D pointer
events also carry `img_x`/`img_y` now.
@CSSFrancis
CSSFrancis merged commit c1e8c36 into main Sep 4, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants