chrplotlib
Plot graphs using chars
install:
$pip install chrplotlib --upgrade
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█▌█▌█▌█▌▌
plot images by name
from chrplotlib import img
img_plotter = img.ImagePlotter()
for name in img_plotter.get_all_names():
print(f"name:{name}")
print(img_plotter.from_name(name=name))
Will print this:
plot from image file
from chrplotlib import img
import cv2
import os
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGE_DIR = os.path.join(CURRENT_DIR, 'data')
img_path = os.path.join(IMAGE_DIR, 'img1.jpeg')
img_data = cv2.imread(img_path)
# print it
print(img.plot_from_img(img_data, max_width=80))
# or save it to .txt file
with open("output.txt", "w") as f:
f.write(img.plot_from_img(img_data, max_width=150))
from this image:
print this:
Plot more images:
Metadata
Release files for chrplotlib 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chrplotlib-0.1.1.tar.gz | 8.2 kB | Without provenance | Details for chrplotlib-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chrplotlib-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for chrplotlib-0.1.1-py3-none-any.whl |
Total release size: 15.9 kB
Release files / chrplotlib-0.1.1.tar.gz
| Download URL | chrplotlib-0.1.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19c85c55c4056d0ff558c0016da46de00f8c6d143eb5ef2e1f19241565659464
|
|
BLAKE2b-256 checksum How to use checksums |
cfa7ac121800cabf7eb4606b34e97ad997e13b31289fcd3ca65652ad1bb68fba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / chrplotlib-0.1.1-py3-none-any.whl
| Download URL | chrplotlib-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c9da0dc660c6694d247a50618ab4a844e3c574e6138355d2e1794dc99f929ca
|
|
BLAKE2b-256 checksum How to use checksums |
60a5940dafe207a571db805e44a56f074c66d6fa2c32b86b3c5f1b8ade268ca2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for chrplotlib 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.