termplotlib
termplotlib is a Python library for all your terminal plotting needs. It aims to work like matplotlib.
Line plots
For line plots, termplotlib relies on gnuplot. With that installed, the code
import termplotlib as tpl
import numpy as np
x = np.linspace(0, 2 * np.pi, 10)
y = np.sin(x)
fig = tpl.figure()
fig.plot(x, y, label="data", width=50, height=15)
fig.show()
produces
1 +---------------------------------------+
0.8 | ** ** |
0.6 | * ** data ******* |
0.4 | ** |
0.2 |* ** |
0 | ** |
| * |
-0.2 | ** ** |
-0.4 | ** * |
-0.6 | ** |
-0.8 | **** ** |
-1 +---------------------------------------+
0 1 2 3 4 5 6 7
Horizontal histograms
import termplotlib as tpl
import numpy as np
rng = np.random.default_rng(123)
sample = rng.standard_normal(size=1000)
counts, bin_edges = np.histogram(sample)
fig = tpl.figure()
fig.hist(counts, bin_edges, orientation="horizontal", force_ascii=False)
fig.show()
produces
Horizontal bar charts are covered as well. This
import termplotlib as tpl
fig = tpl.figure()
fig.barh([3, 10, 5, 2], ["Cats", "Dogs", "Cows", "Geese"], force_ascii=True)
fig.show()
produces
Cats [ 3] ************
Dogs [10] ****************************************
Cows [ 5] ********************
Geese [ 2] ********
Vertical histograms
import termplotlib as tpl
import numpy as np
rng = np.random.default_rng(123)
sample = rng.standard_normal(size=1000)
counts, bin_edges = np.histogram(sample, bins=40)
fig = tpl.figure()
fig.hist(counts, bin_edges, grid=[15, 25], force_ascii=False)
fig.show()
produces
Tables
Support for tables has moved over to termtables.
Installation
termplotlib is available from the Python Package Index, so simply do
pip install termplotlib
to install.
Testing
To run the termplotlib unit tests, check out this repository and type
pytest
Similar projects
Metadata
Release files for termplotlib 0.3.9
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 |
|---|---|---|---|---|
| termplotlib-0.3.9.tar.gz | 24.5 kB | Without provenance | Details for termplotlib-0.3.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| termplotlib-0.3.9-py3-none-any.whl | Python 3 | none | any | Details for termplotlib-0.3.9-py3-none-any.whl |
Total release size: 46.1 kB
Release files / termplotlib-0.3.9.tar.gz
| Download URL | termplotlib-0.3.9.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c04cbd67ac61753eac9162a99cbe87c379d4c5daf720af1df55f4423c094203e
|
|
BLAKE2b-256 checksum How to use checksums |
b4608a74d2503dd64975402c7b8d00f6e201e8cbba5348282433fa5fb8d41b67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / termplotlib-0.3.9-py3-none-any.whl
| Download URL | termplotlib-0.3.9-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
827bec59e0de24dfe265b9d9a4adc4df8335aa98f49c1122bd53ced9b72c5206
|
|
BLAKE2b-256 checksum How to use checksums |
69d0ea24907a6d1e3c5e40ff5b58920552c3e1e4e73181a8583d5bd9d5217305
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for termplotlib 0.3.9
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.