Skip to content

Add dependency-free text renderers (text-utf/ascii/ansi/html) for go.Figure#5670

Draft
T4rk1n wants to merge 1 commit into
mainfrom
text-renderers
Draft

Add dependency-free text renderers (text-utf/ascii/ansi/html) for go.Figure#5670
T4rk1n wants to merge 1 commit into
mainfrom
text-renderers

Conversation

@T4rk1n

@T4rk1n T4rk1n commented Jul 20, 2026

Copy link
Copy Markdown

Link to issue

No tracking issue yet — happy to open a feature issue if preferred.

Description of change

Adds four pure-Python, dependency-free plotly.io renderers that draw an existing go.Figure as plain text: text-utf (braille/block-char, default) and text-ascii (7-bit fallback), plus colour variants text-ansi (24-bit truecolor ANSI) and text-html (self-contained class-based HTML). Use via fig.show(renderer="text-utf").

Demo

Testing strategy

Adds unit tests under plotly/io/_text/tests/ covering the drawing canvas and per-mode serializers, the per-trace adapters and renderer registration, and the colour + heatmap paths (golden-output comparisons; numpy-accelerated branches exercised). All 103 tests pass locally.

Additional information

Design is "one grid, many serializers": a Plotly-agnostic cell-grid canvas, per-mode serializers (one per text-* output), and per-trace adapters that turn a go.Figure into canvas calls. Supported traces: scatter/scattergl (lines & markers), bar (honouring orientation, with grouped fan-out), histogram, and heatmap/histogram2d (density shaded via a colorscale-sampled ramp). Per-series colour is normalized from #hex / rgb()/rgba() / CSS name, falling back to the default qualitative palette. Unsupported traces and undersized canvases degrade to a one-line note rather than raising. Output is written as forced UTF-8.

Guidelines

  • I have reviewed the pull request guidelines and the Code of Conduct and confirm that this PR follows them.
  • I have added an entry to the changelog.

…/html)

Add four pure-Python, dependency-free plotly.io renderers that draw an existing
go.Figure as plain text:

- text-utf   — braille/block-char (default)
- text-ascii — 7-bit ASCII fallback
- text-ansi  — 24-bit truecolor ANSI escapes
- text-html  — self-contained class-based HTML fragment

Usable via fig.show(renderer="text-utf") (etc.). Supports scatter/scattergl
(lines & markers), bar (honouring orientation, with grouped fan-out), histogram,
and heatmap/histogram2d (colorscale-sampled density shading). Per-series colour is
taken from each trace's marker/line colour or the default qualitative palette.
Unsupported traces and undersized canvases degrade to a one-line note instead of
raising. Adds unit tests and a CHANGELOG entry.
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