使用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第三方库


热门话题
在reducer中迭代自定义可写组件时出现java问题   属性文件中属性的java命名约定   任务链关闭的java Executor服务   java从Eclipse中的字段生成多个构造函数   java通过继承读取Json   java在不知道密钥的情况下解析json   java camel cxf如何在电子邮件中发送soap请求响应   java程序似乎跳过了if语句的一部分,在移回正确位置之前先移到else语句   测试简单的Java加密/解密inputFileName不存在   java从Jenkins REST API获取所有作业的所有构建的构建细节   java基本包装器和静态“类型”类对象   在WebSphere8.5上部署java代码   java对象相等(对象引用“=”)   java MongoDB整型字段到枚举的转换   每次我重新导入gradle时,IntelliJ都会不断重置Java设置   类型使用键或索引从Java中的数据类型检索值   在Java的列表接口中需要listIterator()和iterator()是什么?