使用utf-8字符和花式颜色的文本模式图

diagram的Python项目详细描述


图表

使用utf-8字符和花式颜色的文本模式图(使用python)。

Build StatusCode Health

功能

  • 水平和垂直条形图
  • 支持3位(16色)和8位(256色)模式颜色 各种预定义选项板(见下文)
  • UTF-8文本图形

安装

Fedora Core 24的系统要求:

dnf install ncurses-devel ncurses-compat-libs

建议使用pip安装/更新。

要安装:

$ sudo pip install diagram

要更新:

$ sudo pip install -U diagram

从github安装:

$ sudo pip install git+https://github.com/tehmaze/diagram.git

示例

图片说一千多字。

< H3>轴图< EH3>

Axis Graph

水平条形图

Horizontal bar graph

使用的绘图字符:

▏ ▎ ▍ ▌ ▋ ▊ ▉ █

垂直条形图

Vertical bar graph

使用的绘图字符:

▁ ▂ ▃ ▄ ▅ ▆ ▇ █

用法

在文档中使用diagram --help

usage: diagram [-h] [-G] [-H] [-V] [-a] [-A] [-c] [-C] [-l] [-L]
               [-f function] [-p palette] [-x characters] [-y characters]
               [-r] [-b] [-s SLEEP] [-i file] [-o file] [-e ENCODING]

optional arguments:
  -h, --help            show this help message and exit

optional drawing mode:
  -G, --graph           axis drawing mode (default)
  -H, --horizontal-bars
                        horizontal drawing mode
  -V, --vertical-bars   vertical drawing mode

optional drawing arguments:
  -a, --axis            draw axis (default: yes)
  -A, --no-axis         don't draw axis
  -c, --color           use colors (default: yes)
  -C, --no-color        don't use colors
  -l, --legend          draw y-axis legend (default: yes)
  -L, --no-legend       don't draw y-axis legend
  -f function, --function function
                        curve manipulation function, use "help" for a list
  -p palette, --palette palette
                        palette name, use "help" for a list
  -x characters, --width characters
                        drawing width (default: auto)
  -y characters, --height characters
                        drawing height (default: auto)
  -r, --reverse         reverse draw graph

optional input and output arguments:
  -b, --batch           batch mode (default: no)
  -k, --keys            input are key-value pairs (default: no) (1)
  -s SLEEP, --sleep SLEEP
                        batch poll sleep time (default: none)
  -i file, --input file
                        input file (default: stdin)
  -o file, --output file
                        output file (default: stdout)
  -e ENCODING, --encoding ENCODING
                        output encoding (default: auto)

(1): only works for the horizontal bar graph, the first argument is the key
and the second value is the data point.

--function ...

参数可以只是函数名或带有参数的函数名, 例如:

diagram -f log

或者,使用参数:

diagram -f log:e

日志

对称对数标度。

平滑

使用Savitzky Golay过滤器平滑(并可选地区分)数据。

--palette ...

默认/光谱

Palette Spectrum

灰色

Palette Grey

红色

Palette Red

绿色

Palette Green

蓝色

Palette Blue

库使用

from diagram import DGWrapper
gram = DGWrapper(data=[points, values])
gram.show()

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
用于批量操作的java RESTful API分块响应   java读取在线存储的文本文件   在Java ME中将双精度舍入到小数点后5位   java查找一个数字的最接近因子   java更改JMenuBar的字体   java Kmeans聚类算法运行时间和复杂性   java是否可以阻止try catch返回null   java内容解析器指向具有正确URI的错误表   java Android Kotlin插装测试未被识别为插装测试   java TestNG@Dataprovider   在forloop和print语句中声明变量时发生java错误   java在Android Studio 3中设置JNI