(ASCII)直方图工具 [英] in-terminal (ASCII) histograms tool
本文介绍了(ASCII)直方图工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
理想情况下,程序应该这样工作:
%> histogram -from 0.0 -to 100.0 -bins 5 file.data
0- 20 ** *** 16 xx%
20- 40 **************** 44 xx%
40- 60 *********** ********* 61 xx%
60- 80 ********* 22 xx%
80-100 **** 14 xx%
解决方案
Bitly开发并发布了一个名为 data_hacks 提供一些ASCII可视化工具。
一个实用程序,用于解析输入数据点并输出文本直方图:
$ cat / tmp / data | histogram.py
#NumSamples = 29; Max = 10.00; Min = 1.00
#Mean = 4.379310;方差= 5.131986; SD = 2.265389
#每个*表示计数1
1.0000 - 1.9000 [1]:*
1.9000 - 2.8000 [5]:*****
2.8000 - 3.7000 [8]:********
3.7000 - 4.6000 [3]:***
4.6000 - 5.5000 [4]:****
5.5000 - 6.4000 [2 ]:
6.4000 - 7.3000 [3]:***
7.3000 - 8.2000 [1]:*
8.2000 - 9.1000 [1]:*
9.1000 - 10.0000 [ 1]:*
为输入数据生成ascii条形图(这类似于uniq- c):
$ cat data | bar_chart.py --sort-keys
#每个*表示计数2
19:0 [1]
19:1 [24] ********** **
19:2 [3] *
19:3 [9] ****
19:4 [5] **
19:5 [41] *******************
20:0 [115] ********************* ************************************
20:1 [181] **** **************************************************** ************************************
20:2 [136] **** **************************************************** **************
20:3 [155] ************************** **************************************************** *
20:4 [150] ************************************* ************************************
20:5 [79] **** ***********************************
21:0 [64] ***** ***************************
21:1 [8] ****
does anybody know of any cmd tools that can plot a histogram in the terminal in ASCII or text format?
Ideally the program would work like this:
%>histogram -from 0.0 -to 100.0 -bins 5 file.data
0- 20 ***** 16 xx%
20- 40 **************** 44 xx%
40- 60 ******************** 61 xx%
60- 80 ********* 22 xx%
80-100 **** 14 xx%
解决方案
Bitly developed and released a Python package called data_hacks that provides some ASCII visualization tools.
A utility that parses input data points and outputs a text histogram:
$ cat /tmp/data | histogram.py
# NumSamples = 29; Max = 10.00; Min = 1.00
# Mean = 4.379310; Variance = 5.131986; SD = 2.265389
# each * represents a count of 1
1.0000 - 1.9000 [ 1]: *
1.9000 - 2.8000 [ 5]: *****
2.8000 - 3.7000 [ 8]: ********
3.7000 - 4.6000 [ 3]: ***
4.6000 - 5.5000 [ 4]: ****
5.5000 - 6.4000 [ 2]: **
6.4000 - 7.3000 [ 3]: ***
7.3000 - 8.2000 [ 1]: *
8.2000 - 9.1000 [ 1]: *
9.1000 - 10.0000 [ 1]: *
Generate an ascii bar chart for input data (this is like a visualization of uniq -c):
$ cat data | bar_chart.py --sort-keys
# each * represents a count of 2
19:0 [ 1]
19:1 [ 24] ************
19:2 [ 3] *
19:3 [ 9] ****
19:4 [ 5] **
19:5 [ 41] ********************
20:0 [ 115] *********************************************************
20:1 [ 181] ******************************************************************************************
20:2 [ 136] ********************************************************************
20:3 [ 155] *****************************************************************************
20:4 [ 150] ***************************************************************************
20:5 [ 79] ***************************************
21:0 [ 64] ********************************
21:1 [ 8] ****
这篇关于(ASCII)直方图工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文