Skip to content

Single-precision arrays in web figures - #98

Merged
max-models merged 1 commit into
develfrom
web-float32
Nov 15, 2026
Merged

max-models merged 1 commit into
develfrom
web-float32

Conversation

@max-models

@max-models max-models commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

web_figure (and so write_web_figure, Canvas.to_json, and plasma-plots' .plotly.json) writes the arrays of the traces and frames in single precision. Plotly writes NumPy arrays as typed arrays ({"dtype": "f8", "bdata": ...}), and a figure on a page needs no more than seven digits.

The files are half as large. The gallery's rotating-spoke animation (30 frames of a 101×101 heatmap and 1500 markers) goes from 5.1 MB to 2.6 MB. Plain lists, integer arrays and the layout are left as they are.

Tests: a new one for a heatmap and its frame (values to 1e-7, f4) and for lists and integer arrays left alone; the suite passes (354).

@max-models
max-models merged commit f148d3c into devel Nov 15, 2026
32 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.

1 participant