Skip to main content

Text mode diagrams using UTF-8 characters and fancy colors

Project description

diagram

Text mode diagrams using UTF-8 characters and fancy colors (using Python).

Build Status Code Health

Features

  • Axial graphs
  • Horizontal and vertical bar graphs
  • Supports both 3 bit (16 color) and 8 bit (256 color) mode colors with various pre-defined palettes (see below)
  • UTF-8 text graphics

Installation

System requirements for Fedora Core 24:

dnf install ncurses-devel ncurses-compat-libs

It's recommended to use pip to install/update.

To install:

$ sudo pip install diagram

To update:

$ sudo pip install -U diagram

To install from github:

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

Examples

Pictures say more than a thousand words.

Axis graph

Axis Graph

Horizontal bar graph

Horizontal bar graph

Drawing characters used:

▏ ▎ ▍ ▌ ▋ ▊ ▉ █

Vertical bar graph

Vertical bar graph

Drawing characters used:

▁ ▂ ▃ ▄ ▅ ▆ ▇ █

Usage

Use diagram --help for documentation:

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 ...

The parameter can be just the function name or the function name with arguments, for example:

diagram -f log

or, with an argument:

diagram -f log:e

log

Symmetrical logarithmic scale.

smooth

Smooth (and optionally differentiate) data with a Savitzky-Golay filter.

--palette ...

default / spectrum

Palette Spectrum

grey

Palette Grey

red

Palette Red

green

Palette Green

blue

Palette Blue

Library Usage

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diagram-0.2.27.tar.gz (96.4 kB view details)

Uploaded Source

Built Distributions

diagram-0.2.27-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

diagram-0.2.27-py2-none-any.whl (13.0 kB view details)

Uploaded Python 2

File details

Details for the file diagram-0.2.27.tar.gz.

File metadata

  • Download URL: diagram-0.2.27.tar.gz
  • Upload date:
  • Size: 96.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.10

File hashes

Hashes for diagram-0.2.27.tar.gz
Algorithm Hash digest
SHA256 565f801ecf4d81f648349b9e5d02befbd9996702a69e1341d9281d8ed9161c43
MD5 301dc14a64950eeefe7220aa7ac98be4
BLAKE2b-256 8d883bf57c0b2970b9d9bde5513c066b589e2333d92e4aab8c274c2aeedd33d8

See more details on using hashes here.

File details

Details for the file diagram-0.2.27-py3-none-any.whl.

File metadata

  • Download URL: diagram-0.2.27-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.10

File hashes

Hashes for diagram-0.2.27-py3-none-any.whl
Algorithm Hash digest
SHA256 f952c160177aa9ecb3e69081ce16c957763b0155837ea7bda1c327d089e3c749
MD5 ca9bde50ad6c8e0d5ec8db0c9bdf1c83
BLAKE2b-256 31cd74e581f10ccaabd48f9773df64e75a198a6da2ae76ff515c4d907dcf86ed

See more details on using hashes here.

File details

Details for the file diagram-0.2.27-py2-none-any.whl.

File metadata

  • Download URL: diagram-0.2.27-py2-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.10

File hashes

Hashes for diagram-0.2.27-py2-none-any.whl
Algorithm Hash digest
SHA256 14ef63bad0d80b77cb379e37aa6920ba6ccfc6686f70886d16fcad9f83a1a1a7
MD5 09a7079f1f0ed2f3c480214d9c2423df
BLAKE2b-256 08b78615ec07f278d74cf42942ad5875b7c36da7feaab46dc635f3eda538dee2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page