https://github.com/lollo03/termplots
A lightweight plot library for your terminal
https://github.com/lollo03/termplots
plot python terminal
Last synced: 3 months ago
JSON representation
A lightweight plot library for your terminal
- Host: GitHub
- URL: https://github.com/lollo03/termplots
- Owner: lollo03
- License: mit
- Created: 2023-03-23T20:54:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-06T15:07:39.000Z (about 3 years ago)
- Last Synced: 2025-12-16T14:35:43.854Z (6 months ago)
- Topics: plot, python, terminal
- Language: Python
- Homepage: https://pypi.org/project/termplots/
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Termplots
A lightweight plot library for your terminal
## Installation
```
pip install termplots
```
## Get started
### Simple plot
```python
import termplots as tmp
tmp.plot([-0.5,0,1,0.5,1.5], ystep=0.5)
```
Output:
```
2.0|
1.5| *
1.0| *
0.5| *
0.0|--*-------
0.5|*
1.0|
```
### Multiple plots
```python
import termplots as tmp
tmp.plot([[1,0,2], [-1,0,3,0,2,2]], car=['*', '$', '@'], labels=['List 1', 'List 2'])
```
Output:
```
4|
3| $
2| * $ $
1|*
0|--@---$-----
1|$
2|
*: List 1
$: List 2
@: overlaps
```
### Compact plot
```python
import termplots as tmp
tmp.cplot([[32,20,0, 112],[-32,-20,0,20]])
```
Output:
```
112| *
32|*
20| * #
0|----@---
20| #
32|#
```
or
```python
import termplots as tmp
tmp.cplot([-3,2,1,15])
```
Output:
```
15| *
2| *
1| *
0|--------
3|*
```
## Other arguments
### `plot()`
- `ystep` (default `1`): defines steps on the y axis
- `lowlim`: lower limit of the y axis
- `highlim`: upper limit of the y axis
- `car` (default `['*', '#', '@']`): list of point(s) marker, the last char is used for overlaps
- `labels` (default `None`): list of labels
### `cplot()`
- `car` (default `['*', '#', '@']`): list of point(s) marker, the last char is used for overlaps
- `labels` (default `None`): list of labels
## Colors
Termplots support up to 6 colors. Colors are automatically assigned to different series.
> I tested the colors only on macOS. If the colors don't work try a different terminal or open an issue