tsvsheet logo tsvsheet

Charts

Computed output is plain TSV — the input format charting tools have eaten for decades. Plot a sheet in the terminal, render it to SVG, load it in the browser, or draw the chart inside the grid itself.

Everything here runs against weather.tsvt from tsvsheet.examples:

curl -fsSO https://raw.githubusercontent.com/tsvsheet/tsvsheet.examples/main/weather.tsvt

gnuplot, straight from the pipe

gnuplot reads tab-separated data natively; set key autotitle columnhead turns the sheet’s header row into series titles. The sheet’s last row is a Peak summary of =max/=min formulas — sed '$d' drops it so only the data rows plot. With the dumb terminal, the chart never leaves your terminal:

$ tsv render weather.tsvt | sed '$d' | gnuplot -e \
    "set datafile separator tab; set key autotitle columnhead; set term dumb size 72,20; plot '/dev/stdin' using 2:xtic(1) with linespoints"

A pipe can only be read once, so for multiple series render to a file first — swap the terminal for svg (or pngcairo) and the same sheet becomes an image:

tsv render weather.tsvt | sed '$d' > weather.tsv
gnuplot -e "set datafile separator tab; set key autotitle columnhead; set term svg size 640,360; set output 'weather.svg'; plot 'weather.tsv' using 2:xtic(1) with linespoints, '' using 3 with linespoints"

The browser

d3.tsv has parsed this exact format since d3 was born — d3.autoType even recovers the numbers the formulas computed:

const rows = await d3.tsv("weather.tsv", d3.autoType);
// [{Day: "Mon", High: 72, Low: 55, Range: 17}, …]

Anything downstream that eats TSV or CSV — Observable Plot, Vega-Lite, pandas, a <tsv-sheet> element from tsvsheet.js — takes the same rendered output unchanged.

Or chart inside the grid

Sometimes the chart belongs in the sheet. rept scaled by the data draws bars that render, diff, and grep as text — the trick from the landing page demo:

$ printf 'Month\tRevenue\tChart\nJan\t8200\t=rept("#", round(B2/1000))\nFeb\t9400\t=rept("#", round(B3/1000))\nMar\t12100\t=rept("#", round(B4/1000))\n' > revenue.tsvt
$ tsv render revenue.tsvt | column -t -s$'\t'
Month  Revenue  Chart
Jan    8200     ########
Feb    9400     #########
Mar    12100    ############

Try revenue.tsvt in the playground →