• Stars
    star
    397
  • Rank 107,927 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Text mode diagrams using UTF-8 characters and fancy colors

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()

More Repositories

1

lolcat

Rainbows and unicorns (without Ruby! jay!)
Python
201
star
2

ipcalc

Python IP Calculator
Python
171
star
3

xmodem

XMODEM protocol implementation for Python
Python
92
star
4

netflow

NetFlow version 1, 5, 7, 8, 9 & 10 (IPFIX) support for Go
Go
75
star
5

ansi

ANSI cursor movement and graphics in Python
Python
42
star
6

django-pam

A simple PAM authentication backend for Django
Python
35
star
7

PowerBRRR

48V injection daughter board for Step Stick drivers
32
star
8

natural

Convert data to their natural (human-readable) format
Python
30
star
9

nagios-cli

Nagios Command Line Interface
Python
27
star
10

piece

A fast, feature rich artscene parser
C
20
star
11

confidentiality

🔒 Portable, secure by default cryptography
Java
19
star
12

getent

Python interface to the POSIX getent family of commands (getpwent, getgrent, getnetent, etc.)
Python
13
star
13

sortpem

➿ Sorting utility for PEM files
Go
12
star
14

vc

🔐 Vault Command Line (CLI) Client
Go
10
star
15

cli

Command Line Interface utilities
Python
8
star
16

classified

Classified data scanner
Python
8
star
17

Traquair

🌋 Small format DIY crossed gantry 3D-printer
7
star
18

rancid-grep

Ack/grep like utility to search through RANCID configuration repositories.
Python
7
star
19

sauce

Parser for SAUCE or Standard Architecture for Universal Comment Extensions
Python
6
star
20

artcat

A cat(1) like utility for text mode art
Python
6
star
21

yummie

Automated system upgrades using yum
Python
4
star
22

profont-powerline

Patched ProFont for vim-powerline
4
star
23

tlsspy

TLS protocol analyzer
Python
4
star
24

libcommon

libcommon is a multi-platform support library with a focus on offering simplified and secure patterns for common operations
C
4
star
25

vim-pythonDoc

Python documentation shortcut
Vim Script
4
star
26

mos65xx

💻 Golang MOS Technology 65xx CPU emulator
Assembly
4
star
27

ship-package

🚢 Very simple Linux package builder
Go
3
star
28

parser

General use Pratt style top down object parser
Python
3
star
29

vim-pythonGotoFile

Python goto file for vim
Vim Script
2
star
30

textmodes-archive-pc

Artscene archives with PC art
2
star
31

go-binarypack

BinaryPack for Go
Go
2
star
32

maze.io

maze.io generator
Python
2
star
33

edid

Extracts extended display identification data information using the RandR extension
C
2
star
34

moondeck

Stream Deck (compatible) interface for Klipper and Moonraker API
1
star
35

hiera-eyaml-secretbox

NaCl Secret Box asymmetric encryption back end
Ruby
1
star
36

specinfo

Gather information from a spec file
C
1
star
37

klipper-flsun-superracer

My Klipper configuration for the FLSUN SuperRacer
1
star
38

capture

Python module to capture stdout and/or stderr
Python
1
star