Skip to content

fix: skip outline vertices of scatter3d markers without an outline - #3

Draft
katosh wants to merge 1 commit into
mainfrom
pr/glyph-outline
Draft

katosh wants to merge 1 commit into
mainfrom
pr/glyph-outline

Conversation

@katosh

@katosh katosh commented Dec 4, 2026

Copy link
Copy Markdown

Description

This change cuts a scatter3d circle marker from 104 vertices to 60 when the marker has no outline. It is not opt-in, and the pixels stay the same.

Bar chart: a circle marker without an outline holds 104 vertices before and 60 after, and 104 with an outline in the two builds
Vertices per circle marker before and after. The outline draws only when marker.line.width is above 0.

Each glyph marker has a fill mesh and an outline. The outline draws only for marker.line.width above 0, but plotly.js built its vertices for every point. The fix counts and fills them only when the width is above 0. At 100k circle markers it saves 4.4 million vertices, which is 176 MB of vertex buffer data.

The same two lines also apply to markers+text labels. Seven scenes render the same pixels as main at pixel ratios 1 and 2, and hover ids match.

AnnZarro, an AnnData viewer from the Setty lab (https://github.com/settylab/annzarro), draws millions of single cells as 3D markers. This is where the limit showed up. I am glad to rework, split or drop any part.

Closes #

Changes

  • gl-scatter3d counts and fills outline vertices only when lineWidth is above 0. The change is a fork commit that stackgl_modules/package.json pins, and stackgl_modules/index.js is rebuilt from it, as in 58d0503.
  • A spec in scatter3d_test.js for the vertex counts with marker.line.width 0, 2 and 0 again
  • draftlogs/XXXX_fix.md

Testing

  • The new spec fails without the change and passes with it
  • Suites that cover the change: scatter3d, gl3d_hover_click, gl3d_plot_interact, gl3dlayout. Two hover specs of gl3d_hover_click fail on main and on this branch in a headless Chrome run.
  • npm run lint and npm run test-syntax pass

Notes

  • The same patch can go to gl-vis/gl-scatter3d first, and a version bump here can replace the pin (the gl-vis pull request follows)
  • All traces, minified: 4,821,312 bytes on main and 4,821,352 bytes on this branch

Checklist

  • The linked issue has the ready-for-pr label, and it has no assignee or lists me as an assignee
  • I opened the pull request from a branch other than main in my fork
  • I selected "Allow edits from maintainers"
  • I did not edit files in dist/
  • I committed package-lock.json only for a dependency change
  • I added a file to draftlogs/ as draftlogs/README.md describes, or I will add one after the pull request opens

The outline of a glyph marker draws only when lineWidth is above 0, but
gl-scatter3d built its vertices for every point. Count and fill them only
when lineWidth is above 0. A circle marker drops from 104 to 60 vertices.
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.

1 participant