Jp
dead simple terminal plots from JSON data. single binary, no dependencies. linux, osx, windows.
Install / Use
/learn @sgreben/JpREADME
jp
Dead simple terminal plots from JSON (or CSV) data. Bar charts, line charts, scatter plots, histograms and heatmaps are supported.

Get it
go get -u github.com/sgreben/jp/cmd/jp
Or download the binary from the releases page.
# Linux
curl -LO https://github.com/sgreben/jp/releases/download/1.1.12/jp_1.1.12_linux_x86_64.zip
unzip jp_1.1.12_linux_x86_64.zip
# OS X
curl -LO https://github.com/sgreben/jp/releases/download/1.1.12/jp_1.1.12_osx_x86_64.zip
unzip jp_1.1.12_osx_x86_64.zip
# Windows
curl -LO https://github.com/sgreben/jp/releases/download/1.1.12/jp_1.1.12_windows_x86_64.zip
unzip jp_1.1.12_windows_x86_64.zip
Use it
jp reads JSON (or CSV) on stdin and prints plots to stdout.
Usage of jp:
-type value
Plot type. One of [line bar scatter hist hist2d] (default line)
-x string
x values (JSONPath expression)
-y string
y values (JSONPath expression)
-xy string
x,y value pairs (JSONPath expression). Overrides -x and -y if given.
-bins uint
Number of histogram bins (default 0 (auto))
-input value
Input type. One of [json csv] (default json)
-height int
Plot height (default 0 (auto))
-width int
Plot width (default 0 (auto))
-canvas value
Canvas type. One of [full full-escape full-bw full-wb quarter braille auto] (default auto)
Examples
Bar chart
Separate X and Y values
$ < examples/tcp-time.json jp -x ..Label -y ..Count -type bar
69
█████████████
█████████████
█████████████
█████████████
█████████████
█████████████ 21
█████████████ █████████████ 7 2 1
█████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
46.85267ms 48.38578ms 49.91889ms 51.452ms 52.98511ms
XY pairs
$ < examples/tcp-time.json jp -xy "..[Label,Count]" -type bar
69
█████████████
█████████████
█████████████
█████████████
█████████████
█████████████ 21
█████████████ █████████████ 7 2 1
█████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
46.85267ms 48.38578ms 49.91889ms 51.452ms 52.98511ms
Y values only (X=index)
$ < examples/tcp-time.json jp -y ..Count -type bar
69
█████████████
█████████████
█████████████
█████████████
█████████████
█████████████ 21
█████████████ █████████████ 7 2 1
█████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
0 1 2 3 4
Array data
$ echo '[[-3, 5], [-2, 0], [-1, 0.1], [0, 1], [1, 2], [2, 3]]' | jp -xy '[*][0, 1]' -type bar
5
███████████
███████████
███████████ 3
███████████ ▄▄▄▄▄▄▄▄▄▄▄
███████████ 2 ███████████
███████████ 1 ███████████ ███████████
███████████ 0.1 ▄▄▄▄▄▄▄▄▄▄▄ ███████████ ███████████
███████████ 0 ▁▁▁▁▁▁▁▁▁▁▁ ███████████ ███████████ ███████████
-3 -2 -1 0 1 2
Line chart
Array data, separate X and Y values
$ jq -n '[range(200)/20 | [., sin]]' | jp -x '[*][0]' -y '[*][1]'
1.059955│ ▄▄▄▖ ▗▄▄▄▖
│ ▄▀▘ ▝▜▖ ▗▞▘ ▝▚
│ ▟ ▝▄ ▗▀ ▜
│ ▟ ▝▄ ▗▀ ▜
│ ▐ ▝▖ ▗▞ ▚▖
│ ▗▘ ▝▖ ▞ ▚
│ ▗▘ ▚ ▞ ▌
│ ▌ ▌ ▗▘ ▝▖
│ ▞ ▝▖ ▌ ▚
│▗▘ ▚ ▞ ▌
│▌ ▌ ▗▘ ▝▖
│ ▝▖ ▗▘ ▐
│ ▐ ▞ ▚
│ ▚ ▐ ▝▖
│ ▝▖ ▗▘ ▐
│ ▐ ▞ ▚
│ ▀▖ ▐
│ ▚ ▄▘
│ ▙ ▗▘
│ ▚ ▄▘
│ ▚▄ ▗▞▘
│ ▝▀▀▀▘
-1.059955└─────────────────────────────────────────────────────────────────────
0 9.95
Array data, XY pairs
$ jq -n '[range(200)/20 | [., sin]]' | jp -xy '[*][0, 1]'
1.059955│ ▄▄▄▖ ▗▄▄▄▖
│ ▄▀▘ ▝▜▖ ▗▞▘ ▝▚
│ ▟ ▝▄ ▗▀ ▜
│ ▟ ▝▄ ▗▀ ▜
│ ▐ ▝▖ ▗▞ ▚▖
│ ▗▘ ▝▖ ▞ ▚
│ ▗▘ ▚ ▞ ▌
│ ▌ ▌ ▗▘ ▝▖
│ ▞ ▝▖ ▌ ▚
│▗▘ ▚ ▞ ▌
│▌ ▌ ▗▘ ▝▖
│ ▝▖ ▗▘ ▐
│ ▐ ▞ ▚
│ ▚ ▐ ▝▖
│ ▝▖ ▗▘ ▐
│ ▐ ▞ ▚
│ ▀▖ ▐
│ ▚ ▄▘
│ ▙ ▗▘
│ ▚ ▄▘
│ ▚▄ ▗▞▘
│ ▝▀▀▀▘
-1.059955└─────────────────────────────────────────────────────────────────────
0 9.95
Y values only (X=index)
$ < examples/tcp-time.json jp -y ..Duration
5.726165e+07│
│
│
│
│ ▗
│ ▟
│ █
│▐▝▖
│▐ ▌ ▌
│▐ ▌ ▌
│▌ ▌ ▐▚
│▌ ▌ ▗ ▗ ▐▐ ▌
│▘ ▌ ▖ ▐ ▞▀▖ ▐▐ ▌
│ ▚ ▐▚ ▗▀▖ ▗▚ ▌▌ ▗▘ ▌ ▖▗▀▌ ▌▐ █
│ ▐ ▛▌ ▚▖▞ ▚▐▖ ▞▐ ▌▌ ▗ ▐ ▐▟▐▞ ▚ ▗ ▌▝▖ ▐▐ ▐
│ ▐ ▐ ▝ ▝▌▝▀ ▝▟ ▚▗▜ ▞ ▘ ▐▖█▗▘ ▌ ▐▐ ▗ ▄▖ ▄▖ ▌▌
│ ▝▚▐ ▘ ▘ ▐▘▝▖▄▌ ▝▝▟ ▀▀▚▟ ▌ ▖▞▘▌▐ ▚ ▗▄ ▐ ▚▄▖ ▄ ▄▘▌▞▄▄▀▚ ▄ ▄▗▞▖▞▄▄▚
│ ▝▌ ▛ ▌ ▝ ▙▞▝ ▝▘ ▝▚▘ ▀▘ ▝▀ ▀ ▐▘ ▚▞▀ ▀ ▘ ▚▘
│
│
│
│
4.446018e+07└──────────────────────────────────────────────────────────────────────────────────────
0 99
Scatter plot
$ < examples/mvrnorm.json jp -xy '..[x,y]' -type scatter
3.535344│ ⠄ ⠄
│ ⠈⠂ ⠂ ⡀ ⠂
│ ⠐⡀⡀⡂ ⠁ ⢄ ⠁ ⠠
│ ⡀ ⠆ ⠈ ⠄⡀ ⠂
│ ⡀ ⠠ ⡀ ⡀ ⠄ ⡀⠐⠄⠁⠐ ⠠⢆⠠⠂⠂⠄⣀⢈ ⡀⠈ ⡀
│ ⡀⠂⠂⠄ ⡀⠂⢔⠠ ⢤⢀⠌⣡⠁⠦⠄⠐⡐⠂⣀⠅⠁⠈ ⠂ ⠈⠁⠁ ⡀ ⠄
│ ⡀ ⢀ ⠄ ⠈⠠ ⠡⠑⠈⠈⢢⡁⡄⢈⠂⢡⠈⡄⡀⠈⠰⢉⡠⠘⢄⢃⠉⢀⣄⠢⠠⠄ ⠠ ⡀⠁ ⡀ ⠂
│ ⠈ ⡂⠈⡁⠈⠄⢂⡹⡐⡡⡆⡥⣙⡶⡼⠱⣅⣅⣼⢗⡱⢐⣈⠑⢁⠂ ⢐⢁⠭⠘⡀ ⠈
│ ⠁ ⢀⠄⢈⠈⡰⢀⡥⠋⣧⣓⣚⡛⢲⣽⣝⣭⢙⣟⢲⡽⣋⡠⣿⣜⣵⠙⡦⠗ ⣡⠁⠁⠁⠄⠠ ⠄⡂
│ ⠄⠌⠌⠡⠉⡐⢯⣵⡏⢵⡞⠂⢰⣽⣷⢛⣯⡣⣷⢭⣞⣏⠤⣾⢡⡻⠢⢊⢠⡠⠸⢄⣃⡀⢁⠐ ⠐⡀ ⠂ ⠄
│ ⠨ ⡈⠂
