Skip to content
Astrohacker

← Projects

Archived project · Interactive plots

TermPlot

Interactive plots for the terminal.

TermPlot brought Plotly charts into a TermSurf pane so someone could explore a result while keeping the shell session that produced it. It supported both two- and three-dimensional plots.

The separately published package could also capture charts as images.

How it works

  • Pipe a figure into the terminal

    A shell pipeline could send a Plotly figure as JSON on standard input. The same program accepted a file, so a saved experiment and a live pipeline could use the same renderer.

  • Inspect the plot in its pane

    The later client asked TermSurf to show its web renderer in an overlay. A reader could zoom or pan with Plotly while the shell session stayed in place. The overlay dimensions were specified in terminal cells.

  • Keep the result in scrollback

    Esc dismissed the interactive plot and left a still image beside the command that produced it. The user could continue typing and scroll back to compare results.

Plot three measurements

This was a Nushell pipeline inside a TermSurf pane. The shell supplied one JSON figure, Plotly rendered the trace, and the terminal supplied the display surface. That boundary let a human or an agent generate the same input without writing a graphical application.

'{"data":[{"x":[1,2,3],"y":[2,1,4],"type":"scatter"}]}' | termplot

Project history

  1. The first published version rendered Plotly in a browser, captured it with Puppeteer, and sent the image to terminals supporting the iTerm image protocol. Introducing Termplot

  2. The 0.3.23 release packaged the TermSurf version independently. Its interactive renderer used the terminal overlay rather than the original screenshot-only workflow. TermPlot 0.3.23 release

  3. The public 0.3.27 release preserved the CLI and web-renderer source together, including the contract for returning a still image to the terminal. TermPlot 0.3.27 source

Sources