All Projects → kakwa → Py Ascii Graph

kakwa / Py Ascii Graph

Licence: other
A simple python lib to print data as ascii histograms

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Py Ascii Graph

Asciichart
Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
Stars: ✭ 1,107 (+934.58%)
Mutual labels:  graph, ascii, chart
Chart.xkcd
Chart.xkcd is a chart library that plots “sketchy”, “cartoony” or “hand-drawn” styled charts.
Stars: ✭ 6,982 (+6425.23%)
Mutual labels:  graph, chart
Clj Xchart
XChart wrapper for Clojure
Stars: ✭ 105 (-1.87%)
Mutual labels:  graph, chart
Pure Vue Chart
Simple and lightweight vue chart component without using chart library dependencies
Stars: ✭ 50 (-53.27%)
Mutual labels:  graph, chart
Uplot
📈 A small, fast chart for time series, lines, areas, ohlc & bars
Stars: ✭ 6,808 (+6262.62%)
Mutual labels:  graph, chart
Amcharts4
The most advanced amCharts charting library for JavaScript and TypeScript apps.
Stars: ✭ 907 (+747.66%)
Mutual labels:  graph, chart
Mpandroidchart
A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Stars: ✭ 34,377 (+32028.04%)
Mutual labels:  graph, chart
Ttyplot
a realtime plotting utility for terminal/console with data input from stdin
Stars: ✭ 532 (+397.2%)
Mutual labels:  graph, chart
Spark
A simple Android sparkline chart view.
Stars: ✭ 1,178 (+1000.93%)
Mutual labels:  graph, chart
Bitcoin Scraper
💲 bitcoin chart history scraper
Stars: ✭ 80 (-25.23%)
Mutual labels:  graph, chart
Gojs
JavaScript diagramming library for interactive flowcharts, org charts, design tools, planning tools, visual languages.
Stars: ✭ 5,739 (+5263.55%)
Mutual labels:  graph, chart
C3
📊 A D3-based reusable chart library
Stars: ✭ 9,163 (+8463.55%)
Mutual labels:  graph, chart
Esp Dash
A blazing fast library to create a functional dashboard for ESP8266 and ESP32
Stars: ✭ 548 (+412.15%)
Mutual labels:  graph, chart
Multi charts
A flutter package which makes it easier to plot different types of charts with lots of customization, made purely in dart
Stars: ✭ 23 (-78.5%)
Mutual labels:  graph, chart
React D3 Tree
🌳 React component to create interactive D3 tree graphs
Stars: ✭ 543 (+407.48%)
Mutual labels:  graph, chart
Ilg
because the world needs another iOS chart library.
Stars: ✭ 13 (-87.85%)
Mutual labels:  graph, chart
Piecharts
Easy to use and highly customizable pie charts library for iOS
Stars: ✭ 476 (+344.86%)
Mutual labels:  graph, chart
Billboard.js
📊 Re-usable, easy interface JavaScript chart library based on D3.js
Stars: ✭ 5,032 (+4602.8%)
Mutual labels:  graph, chart
Rainbarf
it's like Rainmeter, but for CLI!
Stars: ✭ 1,087 (+915.89%)
Mutual labels:  graph, chart
Diffract
A set of d3 based visualization components built for React
Stars: ✭ 87 (-18.69%)
Mutual labels:  graph, chart

py-ascii-graph

A simple python lib to print data as ascii histograms

.. image:: https://secure.travis-ci.org/kakwa/py-ascii-graph.png?branch=master :target: http://travis-ci.org/kakwa/py-ascii-graph :alt: Travis CI

.. image:: https://img.shields.io/pypi/v/ascii_graph.svg :target: https://pypi.python.org/pypi/ascii_graph :alt: PyPI version

.. image:: https://badges.gitter.im/Join%20Chat.svg :alt: Join the chat at https://gitter.im/kakwa/py-ascii-graph :target: https://gitter.im/kakwa/py-ascii-graph?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

.. image:: https://coveralls.io/repos/kakwa/py-ascii-graph/badge.svg?branch=master :target: https://coveralls.io/r/kakwa/py-ascii-graph?branch=master

.. image:: https://readthedocs.org/projects/py-ascii-graph/badge/?version=latest :target: http://py-ascii-graph.readthedocs.org/en/latest/?badge=latest :alt: Documentation Status

.. .. image:: https://img.shields.io/pypi/pyversions/ascii_graph.svg .. :target: https://pypi.python.org/pypi/ascii_graph .. :alt: Supported Python Versions


:Git: Github <https://github.com/kakwa/py-ascii-graph>_ :PyPI: Package <https://pypi.python.org/pypi/ascii_graph>_ :Doc: Documentation <http://py-ascii-graph.readthedocs.org>_ :License: MIT :Author: Pierre-Francois Carpentier - copyright 2014


License

py-ascii-graph is released under the MIT License.

Description

py-ascii-graph is a simple python library to build ascii histograms. Just give it a label and a list of tuples (description, value) and it will automaticaly creates a nice histogram, with all the stuff aligned and fitting in a fixed width line (if possible).

py-ascii-graph although comes with a command line utility.

Examples

Library

Simple example:

.. sourcecode:: python

from ascii_graph import Pyasciigraph

test = [('long_label', 423), ('sl', 1234), ('line3', 531), 
    ('line4', 200), ('line5', 834)]

graph = Pyasciigraph()
for line in  graph.graph('test print', test):
    print(line)

Result:

.. sourcecode:: bash

test print
###############################################################################
████████████████████                                            423  long_label
█████████████████████████████████████████████████████████████  1234  sl        
██████████████████████████                                      531  line3     
█████████                                                       200  line4     
█████████████████████████████████████████                       834  line5

Complex examples (colors, different spacing, no label...):

.. sourcecode:: python

from ascii_graph import Pyasciigraph
from ascii_graph.colors import *
from ascii_graph.colordata import vcolor
from ascii_graph.colordata import hcolor

test = [('long_label', 423), ('sl', 1234), ('line3', 531),
    ('line4', 200), ('line5', 834)]

# One color per line
print('Color example:')
pattern = [Gre, Yel, Red]
data = vcolor(test, pattern)

graph = Pyasciigraph()
for line in graph.graph('vcolor test', data):
    print(line)

# Multicolor on one line
print('\nMultiColor example:')

# Color lines according to Thresholds
thresholds = {
  51:  Gre, 100: Blu, 350: Yel, 500: Red,
}
data = hcolor(test, thresholds)

# graph with colors, power of 1000, different graph symbol,
# float formatting and a few tweaks
graph = Pyasciigraph(
    line_length=120,
    min_graph_length=50,
    separator_length=4,
    multivalue=False,
    human_readable='si',
    graphsymbol='*',
    float_format='{0:,.2f}',
    force_max_value=2000,
    )

for line in graph.graph(label=None, data=data):
    print(line)

Command Line Utility

command line:

.. sourcecode:: bash

$ asciigraph -h
Usage: asciigraph [-l <label>] [-f file] [-s inc|dec] \
   [-c] [-t <first color threshold> [-T <second color threshold>] \
   [-w <number of char>] [-m <min len of char>] [-H] [-M cs|si]

examples:
   printf 'label1:10\nlabel2:100\n' | asciigraph -l 'my graph'
   printf 'label1:1000\nlabel2:20000\n' | asciigraph -l 'my graph' -H -M 'si'
   printf 'l1:100\nl2:1200.42\n' > ./mf; asciigraph -l 'my graph' -f ./mf
   asciigraph -l 'my graph' -f mf -s inc
   asciigraph -l 'my graph' -f mf -s dec -w 60 -m 10
   asciigraph -l 'my graph' -f mf -c -F '{0:,.2f}'
   asciigraph -l 'my graph' -f mf -c -t 5 -T 50


Options:
  -h, --help            show this help message and exit
  -f FILE, --file=FILE  import data from FILE (one data per line,
                        format: <label>:<value>)
  -s SORT, --sort=SORT  sort type: inc (increasing) or dec (decreasing)
  -l LAB, --label=LAB   label of the graph
  -w WIDTH, --width=WIDTH
                        width of the graph
  -m LEN, --min_graph=LEN
                        minimum length of the graph bar
  -c, --color           Color the graph
  -t TC1, --threshold-1=TC1
                        first color threshold, only make sense if --color is
                        passed
  -T TC2, --threshold-2=TC2
                        second color threshold, only make sense if --color is
                        passed
  -H, --human-readable  enable human readable mode (K, M, G, etc)
  -M HR_MODE, --human-readable-mode=HR_MODE
                        Human readable mode ('cs' -> power of 1024 or 'si' ->
                        power of 1000, default: cs)
  -F FORMAT, --float-format=FORMAT
                        float formatting, ex: {0:,.2f}

See the examples/ directory for more examples.

Installation

.. sourcecode:: bash

$ pip install ascii_graph

or

.. sourcecode:: bash

$ easy_install ascii_graph
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].