diff options
author | Sergey Grebenshchikov <sgreben@gmail.com> | 2018-03-30 01:16:40 +0200 |
---|---|---|
committer | Sergey Grebenshchikov <sgreben@gmail.com> | 2018-03-30 01:17:03 +0200 |
commit | d9d6da484640d23fd88e0323ea3b80d14981d3fa (patch) | |
tree | f887590dca695f54b75a7bd0ab18f71f7b9558cd | |
parent | c7e51836101e57e837c1f8834978942158a78219 (diff) |
Fix histogram bin labels1.1.4
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.md | 64 | ||||
-rw-r--r-- | pkg/data/histogram.go | 2 |
3 files changed, 34 insertions, 34 deletions
@@ -1,4 +1,4 @@ -VERSION = 1.1.3 +VERSION = 1.1.4 APP := jp PACKAGES := $(shell go list -f {{.Dir}} ./...) @@ -37,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.1.3/jp_1.1.3_linux_x86_64.zip -unzip jp_1.1.3_linux_x86_64.zip +curl -LO https://github.com/sgreben/jp/releases/download/1.1.4/jp_1.1.4_linux_x86_64.zip +unzip jp_1.1.4_linux_x86_64.zip # OS X -curl -LO https://github.com/sgreben/jp/releases/download/1.1.3/jp_1.1.3_osx_x86_64.zip -unzip jp_1.1.3_osx_x86_64.zip +curl -LO https://github.com/sgreben/jp/releases/download/1.1.4/jp_1.1.4_osx_x86_64.zip +unzip jp_1.1.4_osx_x86_64.zip # Windows -curl -LO https://github.com/sgreben/jp/releases/download/1.1.3/jp_1.1.3_windows_x86_64.zip -unzip jp_1.1.3_windows_x86_64.zip +curl -LO https://github.com/sgreben/jp/releases/download/1.1.4/jp_1.1.4_windows_x86_64.zip +unzip jp_1.1.4_windows_x86_64.zip ``` ## Use it @@ -285,37 +285,37 @@ $ cat examples/mvrnorm.json | jp -xy '..[x,y]' -type scatter ``` $ cat examples/mvrnorm.json | jp -x ..x -type hist - 684 1 [0.571769,1.14354) - ██████ 2 [1.14354,1.71531) - ██████ 624 3 [1.71531,2.28708) - ████████████ 4 [2.28708,2.85885) - 557 ████████████ 5 [2.85885,3.43062) - ██████████████████ 6 [3.43062,4.00238) - ██████████████████ 7 [4.00238,4.57415) - ██████████████████ 8 [4.57415,5.14592) - ██████████████████ 9 [5.14592,5.71769) - ██████████████████ 404 10 [5.71769,6.28946) - ████████████████████████ 11 [6.28946,6.86123) - 314 ████████████████████████ 12 [6.86123,7.433] - ▄▄▄▄▄▄████████████████████████ - ██████████████████████████████ - ██████████████████████████████ - ██████████████████████████████ - ██████████████████████████████ 176 - ████████████████████████████████████ - 98 ████████████████████████████████████ - ██████████████████████████████████████████ 79 - 1 4 41 ████████████████████████████████████████████████ 14 4 - ▁▁▁▁▁▁▁▁▁▁▁▁██████████████████████████████████████████████████████▁▁▁▁▁▁▁▁▁▁▁▁ - - 0 1 2 3 4 5 6 7 8 9 10 11 12 + 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 ``` #### Fixed bin number ``` $ cat examples/mvrnorm.json | jp -x ..x -type hist -bins 5 - 1652 + 1652 █████████████████ █████████████████ █████████████████ @@ -338,7 +338,7 @@ $ cat examples/mvrnorm.json | jp -x ..x -type hist -bins 5 22 ███████████████████████████████████████████████████ 57 ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███████████████████████████████████████████████████▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ - [0,1.4866) [1.4866,2.9732) [2.9732,4.4598) [4.4598,5.9464) [5.9464,7.433] + [-3.8421,-2.3555)[-2.3555,-0.8689)[-0.8689,0.6177) [0.6177,2.1043) [2.1043,3.5909] ``` ### CSV input diff --git a/pkg/data/histogram.go b/pkg/data/histogram.go index 06e5d95..e16d000 100644 --- a/pkg/data/histogram.go +++ b/pkg/data/histogram.go @@ -64,7 +64,7 @@ func NewBins(points []float64) *Bins { } func (b *Bins) left(i int) float64 { - return (b.max - b.min) / float64(b.Number) * float64(i) + return b.min + ((b.max - b.min) / float64(b.Number) * float64(i)) } func (b *Bins) right(i int) float64 { |