文本数据可视化实用程序库
termdraw的Python项目详细描述
termdraw-ascii/unicode数据可视化工具
termdraw是一个用python 3编写的实用程序,它可以绘制csv格式的数据 作为文本图形。
用法示例
$ cat data.csv 0,41.492605310851346 1,-61.90512769272529 2,-5.705460535578624 3,-45.40738693881286 4,48.57733683988141 5,-11.09276051450491 6,-48.857646527799886 7,20.02380594874974 8,3.8265498423428568 9,-4.993006692763217 0,17.534954337402368 1,-12.048399887989433 2,-67.66449062064824 3,33.3847844218531 4,36.73010900554392 5,62.315666298226745 6,-59.496317272986865 7,74.93745996536751 8,-7.867224323068683 9,51.88925397139964 $ termdraw data.csv • • • • • • • • • • • • • • • • • • • •
假设data.csv包含一个(x,y)点列表,绘制这些点的图形,打印 结果到标准输出。
$ termdraw data.csv --width=10 -h 5 • • •• • • •• •• •• • •• ••• •
画10个字符宽5行高的图形。
$ echo"1,2 2,3 3,4;4,5"| termdraw - • • • •
读取标准输入和图形x,y点。通过stdin接收的数据必须具有 以下格式:x,y[%sx,y…],其中%s是分隔符(单个空格或 分号)。
$ echo"1,2 2,3 3,4 4,5"| termdraw - -a o o o o
只在输出中使用ascii符号。
$ termdraw data.csv -s ▁ █ ▂ █ █ ▄ ▇ ▃ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ ▄ █ █ ▄ ▇ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ ▁ █ █ █ █ █ █ █ █ █ █ █ █ █
绘制一个立体图(填充点上或点下的值)。
$ termdraw data.csv -si ▁ █ ▂▄▆▇█ █▄ ▄ ▇ ▃▅██████ ▃██ ▆█ █▆ ▄████████▆ ████ ▂███ ██▅ ▅██████████ ████▄████ ███▄▅▆▇███████████▄ ▆█████████ ███████████████████ ██████████ ███████████████████▁██████████ ██████████████████████████████
用点之间的线性插值绘制图形。
$ termdraw data.csv --print-paths data.csv • • • • • • • • • • • • • • • • • • • •
在打印文件路径的图形之前,请在单独的行上打印文件路径。
$ termdraw --help Usage: termdraw.py [options] file.csv Draw a human-friendly CLI graph with Unicode symbols. --help Print this help message and exit -w X, --width X Limit graph width to X characters -h Y, --height Y Limit graph height to Y lines -i, --interpolate Enable interpolation -n, --no-interpolate Disable interpolation -s, --solid Draw solid graph (with columns) -p, --point Draw point graph (with points) -a, --ascii Only use ASCII symbols -o file, --output file Write to file instead of stdout --print-paths Print file names before graphs
打印帮助消息。