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

Uploaded Source

Built Distribution

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

Uploaded Python 3

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