summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Grebenshchikov <sgreben@users.noreply.github.com>2018-03-30 16:22:25 +0200
committerGitHub <noreply@github.com>2018-03-30 16:22:25 +0200
commit5201bf26a3268a0cad21dcbf24f1b88158e0c5ad (patch)
tree6c8f28ddc21d4ad61b9e1a67acc51bf71728af0f
parent83d1d2f0a10ea93250746512992998418fe41479 (diff)
parentfaee861f58fca9e052126e698d275e107b575b2a (diff)
Merge branch 'master' into patch-1
-rw-r--r--.travis.yml7
-rw-r--r--Makefile27
-rw-r--r--README.md375
-rw-r--r--README.template.md373
-rw-r--r--cmd/jp/bar.go39
-rw-r--r--cmd/jp/canvas_other.go10
-rw-r--r--cmd/jp/canvas_windows.go10
-rw-r--r--cmd/jp/csv.go29
-rw-r--r--cmd/jp/flag.go6
-rw-r--r--cmd/jp/hist.go50
-rw-r--r--cmd/jp/line.go45
-rw-r--r--cmd/jp/main.go117
-rw-r--r--cmd/jp/scatter.go52
-rw-r--r--cmd/jp/split.go6
-rw-r--r--docs/bar_chart.pngbin46350 -> 42164 bytes
-rw-r--r--docs/line_chart.pngbin41045 -> 47349 bytes
-rw-r--r--docs/scatter_plot.pngbin0 -> 86690 bytes
-rw-r--r--examples/mvrnorm.json12002
-rw-r--r--examples/sin.csv200
-rw-r--r--pkg/data/histogram.go108
-rw-r--r--pkg/data/table.go14
-rw-r--r--pkg/draw/box.go (renamed from pkg/jp/primitives/box.go)2
-rw-r--r--pkg/draw/braille.go42
-rw-r--r--pkg/draw/buffer.go108
-rw-r--r--pkg/draw/canvas.go23
-rw-r--r--pkg/draw/full.go11
-rw-r--r--pkg/draw/line.go (renamed from pkg/jp/primitives/line.go)7
-rw-r--r--pkg/draw/quarter.go37
-rw-r--r--pkg/draw/runes.go12
-rw-r--r--pkg/draw/runes_windows.go11
-rw-r--r--pkg/jp/barchart.go124
-rw-r--r--pkg/jp/datatable.go14
-rw-r--r--pkg/jp/linechart.go205
-rw-r--r--pkg/jp/primitives/buffer.go9
-rw-r--r--pkg/jp/primitives/format.go8
-rw-r--r--pkg/jp/primitives/runes.go18
-rw-r--r--pkg/plot/barchart.go116
-rw-r--r--pkg/plot/format.go20
-rw-r--r--pkg/plot/linechart.go105
-rw-r--r--pkg/plot/scatterchart.go62
-rw-r--r--pkg/terminal/terminal.go4
-rw-r--r--pkg/terminal/terminal_nosysioctl.go2
-rw-r--r--pkg/terminal/terminal_sysioctl.go16
l---------vendor/github.com/sgreben/jp1
44 files changed, 13847 insertions, 580 deletions
diff --git a/.travis.yml b/.travis.yml
index 676ebb1..73109e1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,13 @@
language: go
go:
- "1.10"
-script: make zip
+script: make zip README.md
deploy:
provider: releases
- api_key: "GITHUB OAUTH TOKEN"
+ api_key:
+ secure: "ZFj9EipPgHU5RLyzgOXx+dI4P3UOgwHb//dplU5YIQaSoaYutdakhmzqxVjwHl5UxyNGnUiUaaPS1TG+rfW3fV2ENA7+WTxGZCxPidLC2XQgMKfQyabGxA460A7VPdY8X1nVz2mZnbGa8VRNaI2Z8838Imivo1biKo07bySU850JsU0OFezZqDpC3I0TLsvBnLWszFjJxCUIPvrlQTZsAmtBtNPqmTuJB5HxPKKFaB1ScKmZT91MxBrdkn+s2jmv+ucSe4gz+ktnS2htfzDkbXBbFGVTA1FVXgIHyq/ErVLjC5RFOPXn4bv6HOSqfQ5X78ICQ3BdIPoq7XJt4goH1fBDe2xBLG/HKGZRe8nS7AuJb+DAlcl3qJp1miUldVNF9o0sjvYaw0rrhcRwXm6bR4HVQ34/9zGU4OxQMMRIMOGEIi5dnE9bcC0gyeqBkyI+zCwAGhZt5GfXpSzxSUfhSW3GkiuVVoZctpwRo+snbf+RzThDxuXe1ipHj7djkGs6YdLgEHXOnVF0lVrDH6sciiN+i4CDlHZqypERLVfcSAwOgz6Ulie54dW0CHj6y9IAz75LsphlSa2SUN8YLPeKPptvFhEiMGEC/KRWIws+h3o2lv1ff8DpK3sgf1IIKwPduZnCu5YNDc60qGiGtCc0v/MT+ykYV5aAJtbuWYG0+Ng="
file_glob: true
file: release/*
skip_cleanup: true
on:
- tags: true
+ tags: true \ No newline at end of file
diff --git a/Makefile b/Makefile
index a12c493..31eaeb6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,27 +1,34 @@
-VERSION = 1.0.1
+VERSION = 1.1.5
APP := jp
PACKAGES := $(shell go list -f {{.Dir}} ./...)
GOFILES := $(addsuffix /*.go,$(PACKAGES))
GOFILES := $(wildcard $(GOFILES))
-.PHONY: clean release docker docker-latest
-
-# go get -u github.com/github/hub
-
-docker-latest: docker
- docker tag quay.io/sergey_grebenshchikov/$(APP):v$(VERSION) quay.io/sergey_grebenshchikov/$(APP):latest
- docker push quay.io/sergey_grebenshchikov/$(APP):latest
+.PHONY: clean release release-ci release-manual docker docker-latest README.md
clean:
rm -rf binaries/
rm -rf release/
-release: zip
+release-ci: README.md zip
+
+release:
+ git tag "$(VERSION)"
+ git push origin "$(VERSION)"
+
+# go get -u github.com/github/hub
+release-manual: README.md zip
git push
- hub release delete $(VERSION) || true
hub release create $(VERSION) -m "$(VERSION)" -a release/$(APP)_$(VERSION)_osx_x86_64.zip -a release/$(APP)_$(VERSION)_windows_x86_64.zip -a release/$(APP)_$(VERSION)_linux_x86_64.zip -a release/$(APP)_$(VERSION)_osx_x86_32.zip -a release/$(APP)_$(VERSION)_windows_x86_32.zip -a release/$(APP)_$(VERSION)_linux_x86_32.zip -a release/$(APP)_$(VERSION)_linux_arm64.zip
+README.md:
+ sed "s/\$${VERSION}/$(VERSION)/g" README.template.md > README.md
+
+docker-latest: docker
+ docker tag quay.io/sergey_grebenshchikov/$(APP):v$(VERSION) quay.io/sergey_grebenshchikov/$(APP):latest
+ docker push quay.io/sergey_grebenshchikov/$(APP):latest
+
docker: binaries/linux_x86_64/$(APP)
docker build -t quay.io/sergey_grebenshchikov/$(APP):v$(VERSION) .
docker push quay.io/sergey_grebenshchikov/$(APP):v$(VERSION)
diff --git a/README.md b/README.md
index 3e701ed..25faf25 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,29 @@
# jp
-Dead simple terminal plots from JSON data. Bar charts and line charts are supported.
+Dead simple terminal plots from JSON (or CSV) data. Bar charts, line charts, and scatter plots are supported.
+
+[![Build Status](https://travis-ci.org/sgreben/jp.svg?branch=master)](https://travis-ci.org/sgreben/jp)
<!-- TOC -->
- [Get it](#get-it)
- [Use it](#use-it)
- [Examples](#examples)
- - [Screenshots](#screenshots)
- [Bar chart](#bar-chart)
- [Separate X and Y values](#separate-x-and-y-values)
- [XY pairs](#xy-pairs)
- [Y values only (X=index)](#y-values-only-xindex)
- [Array data](#array-data)
- [Line chart](#line-chart)
- - [Y values only (X=index)](#y-values-only-xindex-1)
- [Array data, separate X and Y values](#array-data-separate-x-and-y-values)
- [Array data, XY pairs](#array-data-xy-pairs)
+ - [Y values only (X=index)](#y-values-only-xindex-1)
+ - [Scatter plot](#scatter-plot)
+ - [Histogram](#histogram)
+ - [Auto bin number](#auto-bin-number)
+ - [Fixed bin number](#fixed-bin-number)
+ - [CSV input](#csv-input)
+- [Screenshots](#screenshots)
<!-- /TOC -->
@@ -30,16 +37,16 @@ Or [download the binary](https://github.com/sgreben/jp/releases/latest) from the
```bash
# Linux
-curl -LO https://github.com/sgreben/jp/releases/download/1.0.1/jp_1.0.1_linux_x86_64.zip
-unzip jp_1.0.1_linux_x86_64.zip
+curl -LO https://github.com/sgreben/jp/releases/download/1.1.5/jp_1.1.5_linux_x86_64.zip
+unzip jp_1.1.5_linux_x86_64.zip
# OS X
-curl -LO https://github.com/sgreben/jp/releases/download/1.0.1/jp_1.0.1_osx_x86_64.zip
-unzip jp_1.0.1_osx_x86_64.zip
+curl -LO https://github.com/sgreben/jp/releases/download/1.1.5/jp_1.1.5_osx_x86_64.zip
+unzip jp_1.1.5_osx_x86_64.zip
# Windows
-curl -LO https://github.com/sgreben/jp/releases/download/1.0.1/jp_1.0.1_windows_x86_64.zip
-unzip jp_1.0.1_windows_x86_64.zip
+curl -LO https://github.com/sgreben/jp/releases/download/1.1.5/jp_1.1.5_windows_x86_64.zip
+unzip jp_1.1.5_windows_x86_64.zip
```
## Use it
@@ -49,7 +56,7 @@ unzip jp_1.0.1_windows_x86_64.zip
```text
Usage of jp:
-type value
- Plot type. One of [line bar] (default line)
+ Plot type. One of [line bar scatter hist] (default line)
-x string
x values (JSONPath expression)
-y string
@@ -60,33 +67,34 @@ Usage of jp:
Plot height (default 0 (auto))
-width int
Plot width (default 0 (auto))
+ -canvas value
+ Canvas type. One of [full quarter braille auto] (default auto)
+ -bins uint
+ Number of histogram bins (default 0 (auto))
+ -input value
+ Input type. One of [json csv] (default json)
```
## Examples
-### Screenshots
-
-In case you're on mobile, here's some PNGs of what `jp` output looks like:
-
-- ![Bar chart](docs/bar_chart.png)
-- ![Line chart](docs/line_chart.png)
-
### Bar chart
#### Separate X and Y values
```bash
$ cat examples/tcp-time.json | jp -x ..Label -y ..Count -type bar
- 69.0
- █████████████
- █████████████
- █████████████
- █████████████
- █████████████ 21.0
- █████████████ █████████████ 7.0 2.0 1.0
- █████████████ █████████████ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
- 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
```
@@ -94,16 +102,18 @@ $ 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.0
- █████████████
- █████████████
- █████████████
- █████████████
- █████████████ 21.0
- █████████████ █████████████ 7.0 2.0 1.0
- █████████████ █████████████ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
- 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)
@@ -111,16 +121,17 @@ $ cat examples/tcp-time.json | jp -xy "..[Label,Count]" -type bar
```bash
$ cat examples/tcp-time.json | jp -y ..Count -type bar
- 69.0
- █████████████
- █████████████
- █████████████
- █████████████
- █████████████ 21.0
- █████████████ █████████████ 7.0 2.0 1.0
- █████████████ █████████████ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
-
- 0 1 2 3 4
+ 69
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████
+ █████████████ 21
+ █████████████ █████████████ 7 2 1
+ █████████████ █████████████ ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁
+
+ 0 1 2 3 4
```
#### Array data
@@ -128,83 +139,235 @@ $ 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.0
- ███████████
- ███████████
- ███████████ 3.0
- ███████████ ███████████
- ███████████ 2.0 ███████████
- ███████████ 0.0 0.1 1.0 ███████████ ███████████
- ███████████ ▁▁▁▁▁▁▁▁▁▁▁ ███████████ ███████████ ███████████
-
- -3 -2 -1 0 1 2
+ 5
+ ███████████
+ ███████████
+ ███████████ 3
+ ███████████ ▄▄▄▄▄▄▄▄▄▄▄
+ ███████████ 2 ███████████
+ ███████████ 1 ███████████ ███████████
+ ███████████ 0.1 ▄▄▄▄▄▄▄▄▄▄▄ ███████████ ███████████
+ ███████████ 0 ▁▁▁▁▁▁▁▁▁▁▁ ███████████ ███████████ ███████████
+
+ -3 -2 -1 0 1 2
```
### Line chart
+#### Array data, separate X and Y values
+
+```bash
+$ jq -n '[range(200)/20 | [., sin]]' | jp -x '[*][0]' -y '[*][1]'
+ 1.059955│ ▄▄▄▖ ▗▄▄▄▖
+ │ ▄▀▘ ▝▜▖ ▗▞▘ ▝▚
+ │ ▟ ▝▄ ▗▀ ▜
+ │ ▟ ▝▄ ▗▀ ▜
+ │ ▐ ▝▖ ▗▞ ▚▖
+ │ ▗▘ ▝▖ ▞ ▚
+ │ ▗▘ ▚ ▞ ▌
+ │ ▌ ▌ ▗▘ ▝▖
+ │ ▞ ▝▖ ▌ ▚
+ │▗▘ ▚ ▞ ▌
+ │▌ ▌ ▗▘ ▝▖
+ │ ▝▖ ▗▘ ▐
+ │ ▐ ▞ ▚
+ │ ▚ ▐ ▝▖
+ │ ▝▖ ▗▘ ▐
+ │ ▐ ▞ ▚
+ │ ▀▖ ▐
+ │ ▚ ▄▘
+ │ ▙ ▗▘
+ │ ▚ ▄▘
+ │ ▚▄ ▗▞▘
+ │ ▝▀▀▀▘
+ -1.059955└─────────────────────────────────────────────────────────────────────
+ 0 9.95
+```
+
+#### Array data, XY pairs
+
+```bash
+$ jq -n '[range(200)/20 | [., sin]]' | jp -xy '[*][0, 1]'
+ 1.059955│ ▄▄▄▖ ▗▄▄▄▖
+ │ ▄▀▘ ▝▜▖ ▗▞▘ ▝▚
+ │ ▟ ▝▄ ▗▀ ▜
+ │ ▟ ▝▄ ▗▀ ▜
+ │ ▐ ▝▖ ▗▞ ▚▖
+ │ ▗▘ ▝▖ ▞ ▚
+ │ ▗▘ ▚ ▞ ▌
+ │ ▌ ▌ ▗▘ ▝▖
+ │ ▞ ▝▖ ▌ ▚
+ │▗▘ ▚ ▞ ▌
+ │▌ ▌ ▗▘ ▝▖
+ │ ▝▖ ▗▘ ▐
+ │ ▐ ▞ ▚
+ │ ▚ ▐ ▝▖
+ │ ▝▖ ▗▘ ▐
+ │ ▐ ▞ ▚
+ │ ▀▖ ▐
+ │ ▚ ▄▘
+ │ ▙ ▗▘
+ │ ▚ ▄▘
+ │ ▚▄ ▗▞▘
+ │ ▝▀▀▀▘
+ -1.059955└─────────────────────────────────────────────────────────────────────
+ 0 9.95
+```
+
#### Y values only (X=index)
```bash
$ cat examples/tcp-time.json | jp -y ..Duration
+ 5.726165e+07│
+ │
+ │
+ │
+ │ ▗
+ │ ▟
+ │ █
+ │▐▝▖
+ │▐ ▌ ▌
+ │▐ ▌ ▌
+ │▌ ▌ ▐▚
+ │▌ ▌ ▗ ▗ ▐▐ ▌
+ │▘ ▌ ▖ ▐ ▞▀▖ ▐▐ ▌
+ │ ▚ ▐▚ ▗▀▖ ▗▚ ▌▌ ▗▘ ▌ ▖▗▀▌ ▌▐ █
+ │ ▐ ▛▌ ▚▖▞ ▚▐▖ ▞▐ ▌▌ ▗ ▐ ▐▟▐▞ ▚ ▗ ▌▝▖ ▐▐ ▐
+ │ ▐ ▐ ▝ ▝▌▝▀ ▝▟ ▚▗▜ ▞ ▘ ▐▖█▗▘ ▌ ▐▐ ▗ ▄▖ ▄▖ ▌▌
+ │ ▝▚▐ ▘ ▘ ▐▘▝▖▄▌ ▝▝▟ ▀▀▚▟ ▌ ▖▞▘▌▐ ▚ ▗▄ ▐ ▚▄▖ ▄ ▄▘▌▞▄▄▀▚ ▄ ▄▗▞▖▞▄▄▚
+ │ ▝▌ ▛ ▌ ▝ ▙▞▝ ▝▘ ▝▚▘ ▀▘ ▝▀ ▀ ▐▘ ▚▞▀ ▀ ▘ ▚▘
+ │
+ │
+ │
+ │
+ 4.446018e+07└──────────────────────────────────────────────────────────────────────────────────────
+ 0 99
+```
-59970040.9│
- │
- │
- │ █
- │██
- │██ █
- │█ █ █ █
- y█ █ ██ ██ █ █ ███ ███ █ █ █
- │ ██ ██ ███ ████ ███ ██ █ ██ █ ███ █ ██ █ █ ██ ██ ██ ██ █ ██ █ █ █ █
- │ █ █ ██ █ ██ ████ ██ █████ ██████ █ ██ ████████ █ ██ █
- │
- │
- │
-42167403.0└───────────────────────────────────────x─────────────────────────────────────────────────
- 0.0 99.0
+### Scatter plot
+```bash
+$ cat examples/mvrnorm.json | jp -xy '..[x,y]' -type scatter
+
+ 3.535344│ ⠄ ⠄
+ │ ⠈⠂ ⠂ ⡀ ⠂
+ │ ⠐⡀⡀⡂ ⠁ ⢄ ⠁ ⠠
+ │ ⡀ ⠆ ⠈ ⠄⡀ ⠂
+ │ ⡀ ⠠ ⡀ ⡀ ⠄ ⡀⠐⠄⠁⠐ ⠠⢆⠠⠂⠂⠄⣀⢈ ⡀⠈ ⡀
+ │ ⡀⠂⠂⠄ ⡀⠂⢔⠠ ⢤⢀⠌⣡⠁⠦⠄⠐⡐⠂⣀⠅⠁⠈ ⠂ ⠈⠁⠁ ⡀ ⠄
+ │ ⡀ ⢀ ⠄ ⠈⠠ ⠡⠑⠈⠈⢢⡁⡄⢈⠂⢡⠈⡄⡀⠈⠰⢉⡠⠘⢄⢃⠉⢀⣄⠢⠠⠄ ⠠ ⡀⠁ ⡀ ⠂
+ │ ⠈ ⡂⠈⡁⠈⠄⢂⡹⡐⡡⡆⡥⣙⡶⡼⠱⣅⣅⣼⢗⡱⢐⣈⠑⢁⠂ ⢐⢁⠭⠘⡀ ⠈
+ │ ⠁ ⢀⠄⢈⠈⡰⢀⡥⠋⣧⣓⣚⡛⢲⣽⣝⣭⢙⣟⢲⡽⣋⡠⣿⣜⣵⠙⡦⠗ ⣡⠁⠁⠁⠄⠠ ⠄⡂
+ │ ⠄⠌⠌⠡⠉⡐⢯⣵⡏⢵⡞⠂⢰⣽⣷⢛⣯⡣⣷⢭⣞⣏⠤⣾⢡⡻⠢⢊⢠⡠⠸⢄⣃⡀⢁⠐ ⠐⡀ ⠂ ⠄
+ │ ⠨ ⡈⠂ ⢀⢑⠄⣜⡾⣴⢨⠶⣪⣧⢿⣷⣷⡱⣿⣞⣲⣮⣮⣯⢾⡷⡬⡷⣺⠤⢏⡼⣨⢌⡬⠠⢂⢠⠒⠱⠆⡈
+ │ ⠈ ⠃ ⠄⡐⠂⠐⢀⢈⣂⡈⣳⣷⣜⢺⣿⣹⣷⣼⣯⡿⣃⣽⣿⢾⣟⣾⢵⣻⠯⡼⡃⣼⣗⢲⠪⠇⣉⠺ ⢱⠠⠙⡀⢐⠌
+ │ ⠄ ⠈⠊⠐⠑⠨⠚⢁⡊⢾⡶⢩⢿⣏⣽⢞⣼⣇⣵⣿⣿⣽⣿⢽⣭⠺⣿⣽⣳⢚⣾⣻⣾⣜⠩⡒⣃⠈⢢⠕⢂⢰⡀ ⡔⢀⢀ ⡀
+ │ ⢀⠂⠁⠂⠇ ⠂⠊⢀⠐⡘⡍⡇⣚⢸⢟⣯⢿⣳⡪⣫⣵⣿⣯⣿⢿⣷⣻⣖⣗⣻⣚⢥⡷⣕⣏⠶⠊⠄⣠⠰⠂⡄⠂ ⠄⠁
+ │ ⠠⢂ ⠘⠐⣀ ⣀⢡⢐⠔⢫⠯⢕⠫⠿⣹⢶⣾⡻⣭⣽⢗⠿⣹⣛⣺⣿⠯⢲⡼⣵⢉⣭⢐⣟⡍⠄⠈⠥⠄ ⠁ ⠄
+ │ ⠈⠂ ⠊⡀⡈⠢⡌⡠⠖⢤⠥⡑⣯⣾⣴⣯⡿⣯⣝⣯⣿⠧⣽⣒⢾⣼⣻⣛⣗⡹⡽⢪⠯⠒⡨⠈ ⠈⡐⢄ ⠂⠘⠠ ⠂
+ │ ⠰ ⡀⠃⠁⠠ ⠉⡈⡨⡱⢍⠌⠷⣯⠫⠬⡙⣴⣯⡣⡟⡮⠩⣫⠿⢞⢵⡰⠞⡂⠴ ⠕⢀⡂⠁ ⢀ ⠤ ⠈
+ │ ⢩⠂ ⠁⡄ ⢀⠲⢂⠑⢁⡘⠄⠵⣣⢑⢻⠨⡩⣌⠕⢮⣮⣋⢹⡁⣊⡃⠈⡕⡘⡠⠨⠄⡘⠨ ⠊⠁ ⠂
+ │ ⠐ ⢀ ⠈⠐⠔⠈ ⠁⢀⣀⡃⣊⢁⡘⠁⠛⠨ ⠒⡑⡀⠵⢙⠄⠡⠢⠃⠄⠋⠅ ⠥⠁⠠⢀ ⠄
+ │ ⢀⢁ ⠆ ⠉⠁⠐ ⠄⠁⢑⡀⢀⠠⠑⢡⢊⠂⠑⠌⡅⠊⠄⠉⢈⡐ ⡀ ⠠ ⠂
+ │ ⢀ ⠑ ⠂ ⡁ ⠌⢠⠈⠂⠄⠉⡃⠈⠄ ⠂⠠⠁ ⠄ ⢀ ⠠
+ │ ⠐ ⠐ ⢁⠂⠂⠢⠠⠄⠔⠐ ⠁
+ │ ⠢ ⠁ ⠂⠐ ⠐ ⠐ ⠈
+ │ ⢀ ⠄⠈ ⠈
+ │ ⠐
+ │
+ │
+ │ ⠈
+-4.271874└─────────────────────────────────────────────────────────────────────
+ -4.08815 3.79083
```
-#### Array data, separate X and Y values
+### Histogram
-```bash
-$ jq -n '[range(200)/20 | [., sin]]' | jp -x '[*][0]' -y '[*][1]'
+#### Auto bin number
-1.1 │ ███████ ██████
- │ ███ ███ ███ ███
- │ ███ ██ ██ ███
- │ ██ ███ ██ ██
- │ █ ██ ██ ███
- │██ ██ ██ ██
- │█ █ ██ ██
- y █ ██ █
- │ ██ ██ ██
- │ ██ ██ ██
- │ ██ ██
- │ ██ ████
- │ ██████
--1.1└───────────────────────────────────x───────────────────────────────────────
- 0.0 9.9
+```
+$ cat examples/mvrnorm.json | jp -x ..x -type hist
+ 684 1 [-3.27033,-2.69856)
+ █████▌ 2 [-2.69856,-2.12679)
+ █████▌ 624 3 [-2.12679,-1.55502)
+ ███████████ 4 [-1.55502,-0.983254)
+ 557 ███████████ 5 [-0.983254,-0.411485)
+ ▐████████████████ 6 [-0.411485,0.160285)
+ ▐████████████████ 7 [0.160285,0.732054)
+ ▐████████████████ 8 [0.732054,1.30382)
+ ▐████████████████ 9 [1.30382,1.87559)
+ ▐████████████████ 404 10 [1.87559,2.44736)
+ ▐█████████████████████▌ 11 [2.44736,3.01913)
+ 314 ▐█████████████████████▌ 12 [3.01913,3.5909]
+ ▄▄▄▄▄▟█████████████████████▌
+ ███████████████████████████▌
+ ███████████████████████████▌
+ ███████████████████████████▌
+ ███████████████████████████▌ 176
+ █████████████████████████████████
+ 98 █████████████████████████████████
+ ▐██████████████████████████████████████ 79
+ 1 4 41 ▐███████████████████████████████████████████ 14 4
+ ▁▁▁▁▁▁▁▁▁▁▁█████████████████████████████████████████████████▁▁▁▁▁▁▁▁▁▁▁
+
+ 0 1 2 3 4 5 6 7 8 9 10 11 12
```
-#### Array data, XY pairs
+#### Fixed bin number
-```bash
-$ jq -n '[range(200)/20 | [., sin]]' | jp -xy '[*][0, 1]'
+```
+$ cat examples/mvrnorm.json | jp -x ..x -type hist -bins 5
+ 1652
+ █████████████████
+ █████████████████
+ █████████████████
+ █████████████████
+ █████████████████
+ █████████████████
+ █████████████████
+