Skip to main content

Char plot in Python

Project description

chrplotlib

Plot graphs using chars

install:

$pip install chrplotlib

For the current developer version:

git clone git@github.com:guofei9987/chrplotlib.git
cd chrplotlib
pip install .

example

from chrplotlib import animation


def update_bar(i):
    data = 10 * np.random.rand(20)
    print(bar(data, label=range(20), max_height=10))
    print('\033[{}A'.format(12))


animation(update_func=update_bar, interval=range(100), pause=0.2)

data = 10 * np.random.rand(20)
label = range(20)
print(bar(data))

Print this:

                                 ▃▃                         
▃▃                      ▃▃       ██                ▅▅       
██ ▇▇                   ██       ██       ▇▇       ██       
██ ██                   ██       ██       ██       ██       
██ ██             ▇▇ ▃▃ ██       ██       ██       ██       
██ ██ ▄▄ ▅▅       ██ ██ ██       ██       ██       ██    ▃▃ 
██ ██ ██ ██    ▂▂ ██ ██ ██       ██ ▃▃    ██       ██    ██ 
██ ██ ██ ██    ██ ██ ██ ██       ██ ██    ██       ██    ██ 
██ ██ ██ ██    ██ ██ ██ ██ ▄▄ ██ ██ ██    ██    ▂▂ ██ ▇▇ ██ 
██ ██ ██ ██ ▃▃ ██ ██ ██ ██ ██ ██ ██ ██ ▃▃ ██ ██ ██ ██ ██ ██ 
print(bar(data=data, label=range(20)))

Print this:

                                 ▃▃                         
▃▃                      ▃▃       ██                ▅▅       
██ ▇▇                   ██       ██       ▇▇       ██       
██ ██                   ██       ██       ██       ██       
██ ██             ▇▇ ▃▃ ██       ██       ██       ██       
██ ██ ▄▄ ▅▅       ██ ██ ██       ██       ██       ██    ▃▃ 
██ ██ ██ ██    ▂▂ ██ ██ ██       ██ ▃▃    ██       ██    ██ 
██ ██ ██ ██    ██ ██ ██ ██       ██ ██    ██       ██    ██ 
██ ██ ██ ██    ██ ██ ██ ██ ▄▄ ██ ██ ██    ██    ▂▂ ██ ▇▇ ██ 
██ ██ ██ ██ ▃▃ ██ ██ ██ ██ ██ ██ ██ ██ ▃▃ ██ ██ ██ ██ ██ ██ 
0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19

print(bar(data, kind='bar'))

Get this:

  █▌█▌█▌█▌█▌█▌█▌█▌▌   
  █▌█▌█▌█▌█▌█▌█▌█▌    
  █▌█▌█▌█▌▋           
  █▌█▌█▌█▌█           
  ▌                   
  █▌█▌█▌▎             
  █▌█▌█▌█▌█▌█▌        
  █▌█▌█▌█▌█▌▌         
  █▌█▌█▌█▌█▌█▌█▌█▌▍   
  █▌▋                 
  █▌█▌                
  █▌█▌█▌█▌█▌█▌█▌█▌█▌▌ 
  █▌█▌█▌▍             
  ▌                   
  █▌█▌█▌█▌█▌█▌█▌█▌    
  █▌                  
  █▌▎                 
  █▌█▌█▌█▌█▌█▌█▌█▌█▎  
  █▌█▌                
  █▌█▌█▌█▌▌           
print(bar(data=data, label=range(20), kind='barh'))

Get this:

0 █▌█▌█▌█▌█▌█▌█▌█▌▌   
1 █▌█▌█▌█▌█▌█▌█▌█▌    
2 █▌█▌█▌█▌▋           
3 █▌█▌█▌█▌█           
4 ▌                   
5 █▌█▌█▌▎             
6 █▌█▌█▌█▌█▌█▌        
7 █▌█▌█▌█▌█▌▌         
8 █▌█▌█▌█▌█▌█▌█▌█▌▍   
9 █▌▋                 
10█▌█▌                
11█▌█▌█▌█▌█▌█▌█▌█▌█▌▌ 
12█▌█▌█▌▍             
13▌                   
14█▌█▌█▌█▌█▌█▌█▌█▌    
15█▌                  
16█▌▎                 
17█▌█▌█▌█▌█▌█▌█▌█▌█▎  
18█▌█▌                
19█▌█▌█▌█▌▌        

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

chrplotlib-0.0.3.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

chrplotlib-0.0.3-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file chrplotlib-0.0.3.tar.gz.

File metadata

  • Download URL: chrplotlib-0.0.3.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for chrplotlib-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e10a5ab18508d86316603b8c7362fc59a71c40403fccd4f47a0e71cf8cb5602b
MD5 77f8aa0894ccaf120585e57341bcea37
BLAKE2b-256 b399ad4d2314374318689a88c8e3e9ea96e56053ee9a9000b070ead5710e8dc8

See more details on using hashes here.

File details

Details for the file chrplotlib-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: chrplotlib-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for chrplotlib-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aeaf2147ba85e9d812577ab81a05adda1b94e9dec49d275b2009e2b8d3602ef0
MD5 f3c29ee5da3e1ada9452ba63fac3483c
BLAKE2b-256 51ed59653ba5c119eb7c123b6f7f740bfa9a5e2a092334e3c96d773c0ac29568

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