Skip to main content

Utility library for textual data visualization

Project description

termdraw - ASCII/Unicode data visualizer

termdraw is a utility written in Python 3 that draws CSV data of form x,y as text graphs.

Usage examples

$ 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
                      •
                •
            •                •
•        •  •
•                     •
                         •
   •  •         •        •   •

         •         •
   •  •            •

Assume data.csv contains a list of (x,y) points, graph those points, print the result to stdout.

$ termdraw data.csv --width=10 -h 5
       •
•   ••   •
•  ••  ••
 ••  •  ••
 •••  •

Draw graphs with dimensions of 10 characters’ width and height of 5 lines.

$ echo "1,2 2,3 3,4;4,5" | termdraw -
                             •


                   •


         •


•

Read standard input and graph x,y points. Data received via stdin must have the following format: x,y[%Sx,y…], where %S is a separator (a single space or semicolon).

$ echo "1,2 2,3 3,4 4,5" | termdraw - -a
                             o


                   o


         o


o

Only use ASCII symbols in output.

$ termdraw data.csv -s

                ▁     █
            ▂   █     █      ▄
▇        ▃  █   █     █      █
█        █  █   █     █      █
█        █  █   █     █  ▄   █
█  ▄  ▇  █  █   █     █  █   █
█  █  █  █  █   █     █  █   █
█  █  █  █  █   █  ▁  █  █   █
█  █  █  █  █   █  █  █  █   █

Draw a solid graph (fills values at or below the points).

$ termdraw data.csv -si

                ▁     █
            ▂▄▆▇█     █▄     ▄
▇        ▃▅██████    ▃██    ▆█
█▆      ▄████████▆   ████ ▂███
██▅    ▅██████████   ████▄████
███▄▅▆▇███████████▄ ▆█████████
███████████████████ ██████████
███████████████████▁██████████
██████████████████████████████

Draw a graph with linear interpolation between points.

$ termdraw data.csv --print-paths
data.csv
                      •
                •
            •                •
•        •  •
•                     •
                         •
   •  •         •        •   •

         •         •
   •  •            •

Print file paths on a separate line before printing their graphs.

$ 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

Print a help message.

Project details


Release history Release notifications

This version
History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
termdraw-0.1-py2-none-any.whl (25.2 kB) Copy SHA256 hash SHA256 Wheel 2.7 Jan 21, 2016
termdraw-0.1-py3-none-any.whl (25.2 kB) Copy SHA256 hash SHA256 Wheel 3.5 Jan 21, 2016
termdraw-0.1.tar.gz (7.6 kB) Copy SHA256 hash SHA256 Source None Jan 21, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page