summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Grebenshchikov <sgreben@gmail.com>2018-06-17 16:02:52 +0200
committerSergey Grebenshchikov <sgreben@gmail.com>2018-06-17 16:02:52 +0200
commitebac9e0cdfaf9943a09f3f873b01339a7218361d (patch)
treec3399b04aef35211e8de8f4c7ba91bae5e7e808e
parentc0140bdf97df0be6e160c0f3bd35f606ca855193 (diff)
Update README, document JSONLines input1.1.12
-rw-r--r--README.md215
-rw-r--r--README.template.md203
2 files changed, 236 insertions, 182 deletions
diff --git a/README.md b/README.md
index 021b2f8..86b6aa7 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,7 @@ Dead simple terminal plots from JSON (or CSV) data. Bar charts, line charts, sca
- [Auto bin number](#auto-bin-number)
- [Fixed bin number](#fixed-bin-number)
- [2D Histogram (heatmap)](#2d-histogram-heatmap)
+ - [JSONLines input](#jsonlines-input)
- [CSV input](#csv-input)
- [Screenshots](#screenshots)
- [Licensing](#licensing)
@@ -37,20 +38,20 @@ Dead simple terminal plots from JSON (or CSV) data. Bar charts, line charts, sca
go get -u github.com/sgreben/jp/cmd/jp
```
-Or [download the binary](https://github.com/sgreben/jp/releases/latest) from the releases page.
+Or [download the binary](https://github.com/sgreben/jp/releases/latest) from the releases page.
```bash
# Linux
-curl -LO https://github.com/sgreben/jp/releases/download/1.1.11/jp_1.1.11_linux_x86_64.zip
-unzip jp_1.1.11_linux_x86_64.zip
+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.11/jp_1.1.11_osx_x86_64.zip
-unzip jp_1.1.11_osx_x86_64.zip
+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.11/jp_1.1.11_windows_x86_64.zip
-unzip jp_1.1.11_windows_x86_64.zip
+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
@@ -88,17 +89,17 @@ Usage of jp:
```bash
$ cat 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
+ 69
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████ 21
+ █████████████ █████████████ 7 2 1
+ █████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
+
+ 46.85267ms 48.38578ms 49.91889ms 51.452ms 52.98511ms
```
@@ -107,17 +108,17 @@ $ cat examples/tcp-time.json | jp -x ..Label -y ..Count -type bar
```bash
$ cat 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
+ 69
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████ 21
+ █████████████ █████████████ 7 2 1
+ █████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
+
+ 46.85267ms 48.38578ms 49.91889ms 51.452ms 52.98511ms
```
#### Y values only (X=index)
@@ -125,17 +126,17 @@ $ cat examples/tcp-time.json | jp -xy "..[Label,Count]" -type bar
```bash
$ cat examples/tcp-time.json | jp -y ..Count -type bar
- 69
- █████████████
- █████████████
- █████████████
- █████████████
- █████████████
- █████████████ 21
- █████████████ █████████████ 7 2 1
- █████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
-
- 0 1 2 3 4
+ 69
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████ 21
+ █████████████ █████████████ 7 2 1
+ █████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
+
+ 0 1 2 3 4
```
#### Array data
@@ -143,17 +144,17 @@ $ cat examples/tcp-time.json | jp -y ..Count -type bar
```bash
$ 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
+ 5
+ ███████████
+ ███████████
+ ███████████ 3
+ ███████████ ▄▄▄▄▄▄▄▄▄▄▄
+ ███████████ 2 ███████████
+ ███████████ 1 ███████████ ███████████
+ ███████████ 0.1 ▄▄▄▄▄▄▄▄▄▄▄ ███████████ ███████████
+ ███████████ 0 ▁▁▁▁▁▁▁▁▁▁▁ ███████████ ███████████ ███████████
+
+ -3 -2 -1 0 1 2
```
### Line chart
@@ -253,34 +254,34 @@ $ cat examples/tcp-time.json | jp -y ..Duration
```bash
$ cat examples/mvrnorm.json | jp -xy '..[x,y]' -type scatter
- 3.535344│ ⠄ ⠄
- │ ⠈⠂ ⠂ ⡀ ⠂
- │ ⠐⡀⡀⡂ ⠁ ⢄ ⠁ ⠠
- │ ⡀ ⠆ ⠈ ⠄⡀ ⠂
- │ ⡀ ⠠ ⡀ ⡀ ⠄ ⡀⠐⠄⠁⠐ ⠠⢆⠠⠂⠂⠄⣀⢈ ⡀⠈ ⡀
- │ ⡀⠂⠂⠄ ⡀⠂⢔⠠ ⢤⢀⠌⣡⠁⠦⠄⠐⡐⠂⣀⠅⠁⠈ ⠂ ⠈⠁⠁ ⡀ ⠄
- │ ⡀ ⢀ ⠄ ⠈⠠ ⠡⠑⠈⠈⢢⡁⡄⢈⠂⢡⠈⡄⡀⠈⠰⢉⡠⠘⢄⢃⠉⢀⣄⠢⠠⠄ ⠠ ⡀⠁ ⡀ ⠂
- │ ⠈ ⡂⠈⡁⠈⠄⢂⡹⡐⡡⡆⡥⣙⡶⡼⠱⣅⣅⣼⢗⡱⢐⣈⠑⢁⠂ ⢐⢁⠭⠘⡀ ⠈
- │ ⠁ ⢀⠄⢈⠈⡰⢀⡥⠋⣧⣓⣚⡛⢲⣽⣝⣭⢙⣟⢲⡽⣋⡠⣿⣜⣵⠙⡦⠗ ⣡⠁⠁⠁⠄⠠ ⠄⡂
- │ ⠄⠌⠌⠡⠉⡐⢯⣵⡏⢵⡞⠂⢰⣽⣷⢛⣯⡣⣷⢭⣞⣏⠤⣾⢡⡻⠢⢊⢠⡠⠸⢄⣃⡀⢁⠐ ⠐⡀ ⠂ ⠄
- │ ⠨ ⡈⠂ ⢀⢑⠄⣜⡾⣴⢨⠶⣪⣧⢿⣷⣷⡱⣿⣞⣲⣮⣮⣯⢾⡷⡬⡷⣺⠤⢏⡼⣨⢌⡬⠠⢂⢠⠒⠱⠆⡈
- │ ⠈ ⠃ ⠄⡐⠂⠐⢀⢈⣂⡈⣳⣷⣜⢺⣿⣹⣷⣼⣯⡿⣃⣽⣿⢾⣟⣾⢵⣻⠯⡼⡃⣼⣗⢲⠪⠇⣉⠺ ⢱⠠⠙⡀⢐⠌
- │ ⠄ ⠈⠊⠐⠑⠨⠚⢁⡊⢾⡶⢩⢿⣏⣽⢞⣼⣇⣵⣿⣿⣽⣿⢽⣭⠺⣿⣽⣳⢚⣾⣻⣾⣜⠩⡒⣃⠈⢢⠕⢂⢰⡀ ⡔⢀⢀ ⡀
- │ ⢀⠂⠁⠂⠇ ⠂⠊⢀⠐⡘⡍⡇⣚⢸⢟⣯⢿⣳⡪⣫⣵⣿⣯⣿⢿⣷⣻⣖⣗⣻⣚⢥⡷⣕⣏⠶⠊⠄⣠⠰⠂⡄⠂ ⠄⠁
- │ ⠠⢂ ⠘⠐⣀ ⣀⢡⢐⠔⢫⠯⢕⠫⠿⣹⢶⣾⡻⣭⣽⢗⠿⣹⣛⣺⣿⠯⢲⡼⣵⢉⣭⢐⣟⡍⠄⠈⠥⠄ ⠁ ⠄
- │ ⠈⠂ ⠊⡀⡈⠢⡌⡠⠖⢤⠥⡑⣯⣾⣴⣯⡿⣯⣝⣯⣿⠧⣽⣒⢾⣼⣻⣛⣗⡹⡽⢪⠯⠒⡨⠈ ⠈⡐⢄ ⠂⠘⠠ ⠂
- │ ⠰ ⡀⠃⠁⠠ ⠉⡈⡨⡱⢍⠌⠷⣯⠫⠬⡙⣴⣯⡣⡟⡮⠩⣫⠿⢞⢵⡰⠞⡂⠴ ⠕⢀⡂⠁ ⢀ ⠤ ⠈
- │ ⢩⠂ ⠁⡄ ⢀⠲⢂⠑⢁⡘⠄⠵⣣⢑⢻⠨⡩⣌⠕⢮⣮⣋⢹⡁⣊⡃⠈⡕⡘⡠⠨⠄⡘⠨ ⠊⠁ ⠂
- │ ⠐ ⢀ ⠈⠐⠔⠈ ⠁⢀⣀⡃⣊⢁⡘⠁⠛⠨ ⠒⡑⡀⠵⢙⠄⠡⠢⠃⠄⠋⠅ ⠥⠁⠠⢀ ⠄
- │ ⢀⢁ ⠆ ⠉⠁⠐ ⠄⠁⢑⡀⢀⠠⠑⢡⢊⠂⠑⠌⡅⠊⠄⠉⢈⡐ ⡀ ⠠ ⠂
- │ ⢀ ⠑ ⠂ ⡁ ⠌⢠⠈⠂⠄⠉⡃⠈⠄ ⠂⠠⠁ ⠄ ⢀ ⠠
- │ ⠐ ⠐ ⢁⠂⠂⠢⠠⠄⠔⠐ ⠁
- │ ⠢ ⠁ ⠂⠐ ⠐ ⠐ ⠈
- │ ⢀ ⠄⠈ ⠈
- │ ⠐
- │
- │
- │ ⠈
+ 3.535344│ ⠄ ⠄
+ │ ⠈⠂ ⠂ ⡀ ⠂
+ │ ⠐⡀⡀⡂ ⠁ ⢄ ⠁ ⠠
+ │ ⡀ ⠆ ⠈ ⠄⡀ ⠂
+ │ ⡀ ⠠ ⡀ ⡀ ⠄ ⡀⠐⠄⠁⠐ ⠠⢆⠠⠂⠂⠄⣀⢈ ⡀⠈ ⡀
+ │ ⡀⠂⠂⠄ ⡀⠂⢔⠠ ⢤⢀⠌⣡⠁⠦⠄⠐⡐⠂⣀⠅⠁⠈ ⠂ ⠈⠁⠁ ⡀ ⠄
+ │ ⡀ ⢀ ⠄ ⠈⠠ ⠡⠑⠈⠈⢢⡁⡄⢈⠂⢡⠈⡄⡀⠈⠰⢉⡠⠘⢄⢃⠉⢀⣄⠢⠠⠄ ⠠ ⡀⠁ ⡀ ⠂
+ │ ⠈ ⡂⠈⡁⠈⠄⢂⡹⡐⡡⡆⡥⣙⡶⡼⠱⣅⣅⣼⢗⡱⢐⣈⠑⢁⠂ ⢐⢁⠭⠘⡀ ⠈
+ │ ⠁ ⢀⠄⢈⠈⡰⢀⡥⠋⣧⣓⣚⡛⢲⣽⣝⣭⢙⣟⢲⡽⣋⡠⣿⣜⣵⠙⡦⠗ ⣡⠁⠁⠁⠄⠠ ⠄⡂
+ │ ⠄⠌⠌⠡⠉⡐⢯⣵⡏⢵⡞⠂⢰⣽⣷⢛⣯⡣⣷⢭⣞⣏⠤⣾⢡⡻⠢⢊⢠⡠⠸⢄⣃⡀⢁⠐ ⠐⡀ ⠂ ⠄
+ │ ⠨ ⡈⠂ ⢀⢑⠄⣜⡾⣴⢨⠶⣪⣧⢿⣷⣷⡱⣿⣞⣲⣮⣮⣯⢾⡷⡬⡷⣺⠤⢏⡼⣨⢌⡬⠠⢂⢠⠒⠱⠆⡈
+ │ ⠈ ⠃ ⠄⡐⠂⠐⢀⢈⣂⡈⣳⣷⣜⢺⣿⣹⣷⣼⣯⡿⣃⣽⣿⢾⣟⣾⢵⣻⠯⡼⡃⣼⣗⢲⠪⠇⣉⠺ ⢱⠠⠙⡀⢐⠌
+ │ ⠄ ⠈⠊⠐⠑⠨⠚⢁⡊⢾⡶⢩⢿⣏⣽⢞⣼⣇⣵⣿⣿⣽⣿⢽⣭⠺⣿⣽⣳⢚⣾⣻⣾⣜⠩⡒⣃⠈⢢⠕⢂⢰⡀ ⡔⢀⢀ ⡀
+ │ ⢀⠂⠁⠂⠇ ⠂⠊⢀⠐⡘⡍⡇⣚⢸⢟⣯⢿⣳⡪⣫⣵⣿⣯⣿⢿⣷⣻⣖⣗⣻⣚⢥⡷⣕⣏⠶⠊⠄⣠⠰⠂⡄⠂ ⠄⠁
+ │ ⠠⢂ ⠘⠐⣀ ⣀⢡⢐⠔⢫⠯⢕⠫⠿⣹⢶⣾⡻⣭⣽⢗⠿⣹⣛⣺⣿⠯⢲⡼⣵⢉⣭⢐⣟⡍⠄⠈⠥⠄ ⠁ ⠄
+ │ ⠈⠂ ⠊⡀⡈⠢⡌⡠⠖⢤⠥⡑⣯⣾⣴⣯⡿⣯⣝⣯⣿⠧⣽⣒⢾⣼⣻⣛⣗⡹⡽⢪⠯⠒⡨⠈ ⠈⡐⢄ ⠂⠘⠠ ⠂
+ │ ⠰ ⡀⠃⠁⠠ ⠉⡈⡨⡱⢍⠌⠷⣯⠫⠬⡙⣴⣯⡣⡟⡮⠩⣫⠿⢞⢵⡰⠞⡂⠴ ⠕⢀⡂⠁ ⢀ ⠤ ⠈
+ │ ⢩⠂ ⠁⡄ ⢀⠲⢂⠑⢁⡘⠄⠵⣣⢑⢻⠨⡩⣌⠕⢮⣮⣋⢹⡁⣊⡃⠈⡕⡘⡠⠨⠄⡘⠨ ⠊⠁ ⠂
+ │ ⠐ ⢀ ⠈⠐⠔⠈ ⠁⢀⣀⡃⣊⢁⡘⠁⠛⠨ ⠒⡑⡀⠵⢙⠄⠡⠢⠃⠄⠋⠅ ⠥⠁⠠⢀ ⠄
+ │ ⢀⢁ ⠆ ⠉⠁⠐ ⠄⠁⢑⡀⢀⠠⠑⢡⢊⠂⠑⠌⡅⠊⠄⠉⢈⡐ ⡀ ⠠ ⠂
+ │ ⢀ ⠑ ⠂ ⡁ ⠌⢠⠈⠂⠄⠉⡃⠈⠄ ⠂⠠⠁ ⠄ ⢀ ⠠
+ │ ⠐ ⠐ ⢁⠂⠂⠢⠠⠄⠔⠐ ⠁
+ │ ⠢ ⠁ ⠂⠐ ⠐ ⠐ ⠈
+ │ ⢀ ⠄⠈ ⠈
+ │ ⠐
+ │
+ │
+ │ ⠈
-4.271874└─────────────────────────────────────────────────────────────────────
-4.08815 3.79083
```
@@ -352,13 +353,13 @@ $ cat examples/mvrnorm.json | jp -x ..x -type hist -bins 5
```
$ cat examples/mvrnorm.json | jp -xy '..[x,y]' -type hist2d
- 3.3608│ ···· ········ ····
- │ ···· ········ ····
- │ ···· ········ ····
- │ ················ ····
- │ ················ ····
- │ ································
- │ ································
+ 3.3608│ ···· ········ ····
+ │ ···· ········ ····
+ │ ···· ········ ····
+ │ ················ ····
+ │ ················ ····
+ │ ································
+ │ ································
│ ················░░░░░░░░░░░░················
│ ················░░░░░░░░░░░░················
│ ············▒▒▒▒▓▓▓▓▒▒▒▒▒▒▒▒░░░░············
@@ -372,18 +373,44 @@ $ cat examples/mvrnorm.json | jp -xy '..[x,y]' -type hist2d
│ ············▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒············
│ ············▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒················
│ ············▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒················
- │ ····································
- │ ····································
- │ ····························
- │ ····························
- │ ···· ···· ····
- │ ···· ···· ····
- │ ····
- │ ····
+ │ ····································
+ │ ····································
+ │ ····························
+ │ ····························
+ │ ···· ···· ····
+ │ ···· ···· ····
+ │ ····
+ │ ····
-4.0045└───────────────────────────────────────────────────
-3.8421 3.5909
```
+### JSONLines input
+
+If your data consists of whitespace-separated JSON values (known as [JSONLines](http://jsonlines.org/) for newline separators), you can use the `-s` ("slurp") mode of `jq` to aggregate your data points into a single array before passing it to `jp`:
+
+```sh
+$ echo "[0,1]" "[1,2]" "[2,3]" | jq -s . | jp
+
+ 3.16│
+ │ ▄▄▀
+ │ ▄▄▀▀
+ │ ▄▄▀▀
+ │ ▗▄▄▀▀
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▄▄▀▘
+ │ ▄▄▀▀
+ │ ▄▄▀▀
+ │▄▀▀
+ 0.94└──────────────────────────────────────────────────────
+ 0 2
+```
+
### CSV input
```
diff --git a/README.template.md b/README.template.md
index 109c09e..37f2e6a 100644
--- a/README.template.md
+++ b/README.template.md
@@ -25,6 +25,7 @@ Dead simple terminal plots from JSON (or CSV) data. Bar charts, line charts, sca
- [Auto bin number](#auto-bin-number)
- [Fixed bin number](#fixed-bin-number)
- [2D Histogram (heatmap)](#2d-histogram-heatmap)
+ - [JSONLines input](#jsonlines-input)
- [CSV input](#csv-input)
- [Screenshots](#screenshots)
- [Licensing](#licensing)
@@ -37,7 +38,7 @@ Dead simple terminal plots from JSON (or CSV) data. Bar charts, line charts, sca
go get -u github.com/sgreben/jp/cmd/jp
```
-Or [download the binary](https://github.com/sgreben/jp/releases/latest) from the releases page.
+Or [download the binary](https://github.com/sgreben/jp/releases/latest) from the releases page.
```bash
# Linux
@@ -88,17 +89,17 @@ Usage of jp:
```bash
$ cat 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
+ 69
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████ 21
+ █████████████ █████████████ 7 2 1
+ █████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
+
+ 46.85267ms 48.38578ms 49.91889ms 51.452ms 52.98511ms
```
@@ -107,17 +108,17 @@ $ cat examples/tcp-time.json | jp -x ..Label -y ..Count -type bar
```bash
$ cat 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
+ 69
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████ 21
+ █████████████ █████████████ 7 2 1
+ █████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
+
+ 46.85267ms 48.38578ms 49.91889ms 51.452ms 52.98511ms
```
#### Y values only (X=index)
@@ -125,17 +126,17 @@ $ cat examples/tcp-time.json | jp -xy "..[Label,Count]" -type bar
```bash
$ cat examples/tcp-time.json | jp -y ..Count -type bar
- 69
- █████████████
- █████████████
- █████████████
- █████████████
- █████████████
- █████████████ 21
- █████████████ █████████████ 7 2 1
- █████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
-
- 0 1 2 3 4
+ 69
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████ 21
+ █████████████ █████████████ 7 2 1
+ █████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
+
+ 0 1 2 3 4
```
#### Array data
@@ -143,17 +144,17 @@ $ cat examples/tcp-time.json | jp -y ..Count -type bar
```bash
$ 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
+ 5
+ ███████████
+ ███████████
+ ███████████ 3
+ ███████████ ▄▄▄▄▄▄▄▄▄▄▄
+ ███████████ 2 ███████████
+ ███████████ 1 ███████████ ███████████
+ ███████████ 0.1 ▄▄▄▄▄▄▄▄▄▄▄ ███████████ ███████████
+ ███████████ 0 ▁▁▁▁▁▁▁▁▁▁▁ ███████████ ███████████ ███████████
+
+ -3 -2 -1 0 1 2
```
### Line chart
@@ -253,34 +254,34 @@ $ cat examples/tcp-time.json | jp -y ..Duration
```bash
$ cat examples/mvrnorm.json | jp -xy '..[x,y]' -type scatter
- 3.535344│ ⠄ ⠄
- │ ⠈⠂ ⠂ ⡀ ⠂
- │ ⠐⡀⡀⡂ ⠁ ⢄ ⠁ ⠠
- │ ⡀ ⠆ ⠈ ⠄⡀ ⠂
- │ ⡀ ⠠ ⡀ ⡀ ⠄ ⡀⠐⠄⠁⠐ ⠠⢆⠠⠂⠂⠄⣀⢈ ⡀⠈ ⡀
- │ ⡀⠂⠂⠄ ⡀⠂⢔⠠ ⢤⢀⠌⣡⠁⠦⠄⠐⡐⠂⣀⠅⠁⠈ ⠂ ⠈⠁⠁ ⡀ ⠄
- │ ⡀ ⢀ ⠄ ⠈⠠ ⠡⠑⠈⠈⢢⡁⡄⢈⠂⢡⠈⡄⡀⠈⠰⢉⡠⠘⢄⢃⠉⢀⣄⠢⠠⠄ ⠠ ⡀⠁ ⡀ ⠂
- │ ⠈ ⡂⠈⡁⠈⠄⢂⡹⡐⡡⡆⡥⣙⡶⡼⠱⣅⣅⣼⢗⡱⢐⣈⠑⢁⠂ ⢐⢁⠭⠘⡀ ⠈
- │ ⠁ ⢀⠄⢈⠈⡰⢀⡥⠋⣧⣓⣚⡛⢲⣽⣝⣭⢙⣟⢲⡽⣋⡠⣿⣜⣵⠙⡦⠗ ⣡⠁⠁⠁⠄⠠ ⠄⡂
- │ ⠄⠌⠌⠡⠉⡐⢯⣵⡏⢵⡞⠂⢰⣽⣷⢛⣯⡣⣷⢭⣞⣏⠤⣾⢡⡻⠢⢊⢠⡠⠸⢄⣃⡀⢁⠐ ⠐⡀ ⠂ ⠄
- │ ⠨ ⡈⠂ ⢀⢑⠄⣜⡾⣴⢨⠶⣪⣧⢿⣷⣷⡱⣿⣞⣲⣮⣮⣯⢾⡷⡬⡷⣺⠤⢏⡼⣨⢌⡬⠠⢂⢠⠒⠱⠆⡈
- │ ⠈ ⠃ ⠄⡐⠂⠐⢀⢈⣂⡈⣳⣷⣜⢺⣿⣹⣷⣼⣯⡿⣃⣽⣿⢾⣟⣾⢵⣻⠯⡼⡃⣼⣗⢲⠪⠇⣉⠺ ⢱⠠⠙⡀⢐⠌
- │ ⠄ ⠈⠊⠐⠑⠨⠚⢁⡊⢾⡶⢩⢿⣏⣽⢞⣼⣇⣵⣿⣿⣽⣿⢽⣭⠺⣿⣽⣳⢚⣾⣻⣾⣜⠩⡒⣃⠈⢢⠕⢂⢰⡀ ⡔⢀⢀ ⡀
- │ ⢀⠂⠁⠂⠇ ⠂⠊⢀⠐⡘⡍⡇⣚⢸⢟⣯⢿⣳⡪⣫⣵⣿⣯⣿⢿⣷⣻⣖⣗⣻⣚⢥⡷⣕⣏⠶⠊⠄⣠⠰⠂⡄⠂ ⠄⠁
- │ ⠠⢂ ⠘⠐⣀ ⣀⢡⢐⠔⢫⠯⢕⠫⠿⣹⢶⣾⡻⣭⣽⢗⠿⣹⣛⣺⣿⠯⢲⡼⣵⢉⣭⢐⣟⡍⠄⠈⠥⠄ ⠁ ⠄
- │ ⠈⠂ ⠊⡀⡈⠢⡌⡠⠖⢤⠥⡑⣯⣾⣴⣯⡿⣯⣝⣯⣿⠧⣽⣒⢾⣼⣻⣛⣗⡹⡽⢪⠯⠒⡨⠈ ⠈⡐⢄ ⠂⠘⠠ ⠂
- │ ⠰ ⡀⠃⠁⠠ ⠉⡈⡨⡱⢍⠌⠷⣯⠫⠬⡙⣴⣯⡣⡟⡮⠩⣫⠿⢞⢵⡰⠞⡂⠴ ⠕⢀⡂⠁ ⢀ ⠤ ⠈
- │ ⢩⠂ ⠁⡄ ⢀⠲⢂⠑⢁⡘⠄⠵⣣⢑⢻⠨⡩⣌⠕⢮⣮⣋⢹⡁⣊⡃⠈⡕⡘⡠⠨⠄⡘⠨ ⠊⠁ ⠂
- │ ⠐ ⢀ ⠈⠐⠔⠈ ⠁⢀⣀⡃⣊⢁⡘⠁⠛⠨ ⠒⡑⡀⠵⢙⠄⠡⠢⠃⠄⠋⠅ ⠥⠁⠠⢀ ⠄
- │ ⢀⢁ ⠆ ⠉⠁⠐ ⠄⠁⢑⡀⢀⠠⠑⢡⢊⠂⠑⠌⡅⠊⠄⠉⢈⡐ ⡀ ⠠ ⠂
- │ ⢀ ⠑ ⠂ ⡁ ⠌⢠⠈⠂⠄⠉⡃⠈⠄ ⠂⠠⠁ ⠄ ⢀ ⠠
- │ ⠐ ⠐ ⢁⠂⠂⠢⠠⠄⠔⠐ ⠁
- │ ⠢ ⠁ ⠂⠐ ⠐ ⠐ ⠈
- │ ⢀ ⠄⠈ ⠈
- │ ⠐
- │
- │
- │ ⠈
+ 3.535344│ ⠄ ⠄
+ │ ⠈⠂ ⠂ ⡀ ⠂
+ │ ⠐⡀⡀⡂ ⠁ ⢄ ⠁ ⠠
+ │ ⡀ ⠆ ⠈ ⠄⡀ ⠂
+ │ ⡀ ⠠ ⡀ ⡀ ⠄ ⡀⠐⠄⠁⠐ ⠠⢆⠠⠂⠂⠄⣀⢈ ⡀⠈ ⡀
+ │ ⡀⠂⠂⠄ ⡀⠂⢔⠠ ⢤⢀⠌⣡⠁⠦⠄⠐⡐⠂⣀⠅⠁⠈ ⠂ ⠈⠁⠁ ⡀ ⠄
+ │ ⡀ ⢀ ⠄ ⠈⠠ ⠡⠑⠈⠈⢢⡁⡄⢈⠂⢡⠈⡄⡀⠈⠰⢉⡠⠘⢄⢃⠉⢀⣄⠢⠠⠄ ⠠ ⡀⠁ ⡀ ⠂
+ │ ⠈ ⡂⠈⡁⠈⠄⢂⡹⡐⡡⡆⡥⣙⡶⡼⠱⣅⣅⣼⢗⡱⢐⣈⠑⢁⠂ ⢐⢁⠭⠘⡀ ⠈
+ │ ⠁ ⢀⠄⢈⠈⡰⢀⡥⠋⣧⣓⣚⡛⢲⣽⣝⣭⢙⣟⢲⡽⣋⡠⣿⣜⣵⠙⡦⠗ ⣡⠁⠁⠁⠄⠠ ⠄⡂
+ │ ⠄⠌⠌⠡⠉⡐⢯⣵⡏⢵⡞⠂⢰⣽⣷⢛⣯⡣⣷⢭⣞⣏⠤⣾⢡⡻⠢⢊⢠⡠⠸⢄⣃⡀⢁⠐ ⠐⡀ ⠂ ⠄
+ │ ⠨ ⡈⠂ ⢀⢑⠄⣜⡾⣴⢨⠶⣪⣧⢿⣷⣷⡱⣿⣞⣲⣮⣮⣯⢾⡷⡬⡷⣺⠤⢏⡼⣨⢌⡬⠠⢂⢠⠒⠱⠆⡈
+ │ ⠈ ⠃ ⠄⡐⠂⠐⢀⢈⣂⡈⣳⣷⣜⢺⣿⣹⣷⣼⣯⡿⣃⣽⣿⢾⣟⣾⢵⣻⠯⡼⡃⣼⣗⢲⠪⠇⣉⠺ ⢱⠠⠙⡀⢐⠌
+ │ ⠄ ⠈⠊⠐⠑⠨⠚⢁⡊⢾⡶⢩⢿⣏⣽⢞⣼⣇⣵⣿⣿⣽⣿⢽⣭⠺⣿⣽⣳⢚⣾⣻⣾⣜⠩⡒⣃⠈⢢⠕⢂⢰⡀ ⡔⢀⢀ ⡀
+ │ ⢀⠂⠁⠂⠇ ⠂⠊⢀⠐⡘⡍⡇⣚⢸⢟⣯⢿⣳⡪⣫⣵⣿⣯⣿⢿⣷⣻⣖⣗⣻⣚⢥⡷⣕⣏⠶⠊⠄⣠⠰⠂⡄⠂ ⠄⠁
+ │ ⠠⢂ ⠘⠐⣀ ⣀⢡⢐⠔⢫⠯⢕⠫⠿⣹⢶⣾⡻⣭⣽⢗⠿⣹⣛⣺⣿⠯⢲⡼⣵⢉⣭⢐⣟⡍⠄⠈⠥⠄ ⠁ ⠄
+ │ ⠈⠂ ⠊⡀⡈⠢⡌⡠⠖⢤⠥⡑⣯⣾⣴⣯⡿⣯⣝⣯⣿⠧⣽⣒⢾⣼⣻⣛⣗⡹⡽⢪⠯⠒⡨⠈ ⠈⡐⢄ ⠂⠘⠠ ⠂
+ │ ⠰ ⡀⠃⠁⠠ ⠉⡈⡨⡱⢍⠌⠷⣯⠫⠬⡙⣴⣯⡣⡟⡮⠩⣫⠿⢞⢵⡰⠞⡂⠴ ⠕⢀⡂⠁ ⢀ ⠤ ⠈
+ │ ⢩⠂ ⠁⡄ ⢀⠲⢂⠑⢁⡘⠄⠵⣣⢑⢻⠨⡩⣌⠕⢮⣮⣋⢹⡁⣊⡃⠈⡕⡘⡠⠨⠄⡘⠨ ⠊⠁ ⠂
+ │ ⠐ ⢀ ⠈⠐⠔⠈ ⠁⢀⣀⡃⣊⢁⡘⠁⠛⠨ ⠒⡑⡀⠵⢙⠄⠡⠢⠃⠄⠋⠅ ⠥⠁⠠⢀ ⠄
+ │ ⢀⢁ ⠆ ⠉⠁⠐ ⠄⠁⢑⡀⢀⠠⠑⢡⢊⠂⠑⠌⡅⠊⠄⠉⢈⡐ ⡀ ⠠ ⠂
+ │ ⢀ ⠑ ⠂ ⡁ ⠌⢠⠈⠂⠄⠉⡃⠈⠄ ⠂⠠⠁ ⠄ ⢀ ⠠
+ │ ⠐ ⠐ ⢁⠂⠂⠢⠠⠄⠔⠐ ⠁
+ │ ⠢ ⠁ ⠂⠐ ⠐ ⠐ ⠈
+ │ ⢀ ⠄⠈ ⠈
+ │ ⠐
+ │
+ │
+ │ ⠈
-4.271874└─────────────────────────────────────────────────────────────────────
-4.08815 3.79083
```
@@ -352,13 +353,13 @@ $ cat examples/mvrnorm.json | jp -x ..x -type hist -bins 5
```
$ cat examples/mvrnorm.json | jp -xy '..[x,y]' -type hist2d
- 3.3608│ ···· ········ ····
- │ ···· ········ ····
- │ ···· ········ ····
- │ ················ ····
- │ ················ ····
- │ ································
- │ ································
+ 3.3608│ ···· ········ ····
+ │ ···· ········ ····
+ │ ···· ········ ····
+ │ ················ ····
+ │ ················ ····
+ │ ································
+ │ ································
│ ················░░░░░░░░░░░░················
│ ················░░░░░░░░░░░░················
│ ············▒▒▒▒▓▓▓▓▒▒▒▒▒▒▒▒░░░░············
@@ -372,18 +373,44 @@ $ cat examples/mvrnorm.json | jp -xy '..[x,y]' -type hist2d
│ ············▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒············
│ ············▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒················
│ ············▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒················
- │ ····································
- │ ····································
- │ ····························
- │ ····························
- │ ···· ···· ····
- │ ···· ···· ····
- │ ····
- │ ····
+ │ ····································
+ │ ····································
+ │ ····························
+ │ ····························
+ │ ···· ···· ····
+ │ ···· ···· ····
+ │ ····
+ │ ····
-4.0045└───────────────────────────────────────────────────
-3.8421 3.5909
```
+### JSONLines input
+
+If your data consists of whitespace-separated JSON values (known as [JSONLines](http://jsonlines.org/) for newline separators), you can use the `-s` ("slurp") mode of `jq` to aggregate your data points into a single array before passing it to `jp`:
+
+```sh
+$ echo "[0,1]" "[1,2]" "[2,3]" | jq -s . | jp
+
+ 3.16│
+ │ ▄▄▀
+ │ ▄▄▀▀
+ │ ▄▄▀▀
+ │ ▗▄▄▀▀
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▗▄▞▀▘
+ │ ▄▄▀▘
+ │ ▄▄▀▀
+ │ ▄▄▀▀
+ │▄▀▀
+ 0.94└──────────────────────────────────────────────────────
+ 0 2
+```
+
### CSV input
```