https://github.com/jeroendelcour/tplot
A library for creating text-based graphs in the terminal
https://github.com/jeroendelcour/tplot
python terminal
Last synced: 3 months ago
JSON representation
A library for creating text-based graphs in the terminal
- Host: GitHub
- URL: https://github.com/jeroendelcour/tplot
- Owner: JeroenDelcour
- License: mit
- Created: 2018-05-15T12:21:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-14T10:07:50.000Z (over 2 years ago)
- Last Synced: 2025-10-09T18:22:53.807Z (9 months ago)
- Topics: python, terminal
- Language: Python
- Homepage:
- Size: 457 KB
- Stars: 169
- Watchers: 3
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# tplot
[](https://tplot.readthedocs.io/en/latest/)
[](https://github.com/JeroenDelcour/tplot/actions/workflows/tests.yml)
[](https://codecov.io/gh/JeroenDelcour/tplot)
[](https://pypi.org/project/tplot/)
[](https://pypi.org/project/tplot/)
[](https://github.com/JeroenDelcour/tplot/blob/master/LICENSE)
`tplot` is a Python package for creating text-based graphs. Useful for visualizing data to the terminal or log files.
## Features
- Scatter plots, line plots, horizontal/vertical bar plots, and image plots
- Supports numerical and categorical data
- Legend
- Unicode characters (with automatic ascii fallback)
- Colors
- Few dependencies
- Fast and lightweight
- Doesn't take over your terminal (only prints strings)
## Installation
`tplot` is available on [PyPi](https://pypi.org/project/tplot/):
```bash
pip install tplot
```
## Documentation
Documentation is available on [readthedocs](https://tplot.readthedocs.io/en/latest/).
## Examples
### Basic usage
```python
import tplot
fig = tplot.Figure()
fig.scatter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
fig.show()
```

### A more advanced example
```python
import tplot
import numpy as np
x = np.linspace(start=0, stop=np.pi*3, num=80)
fig = tplot.Figure(
xlabel="Phase",
ylabel="Amplitude",
title="Trigonometric functions",
legendloc="bottomleft",
width=60,
height=15,
)
fig.line(x, y=np.sin(x), color="red", label="sin(x)")
fig.line(x, y=np.cos(x), color="blue", label="cos(x)")
fig.show()
```

See more examples in the [documentation](https://tplot.readthedocs.io/en/latest/).
## Contributing
Contributions are welcome. Bug fixes, feature suggestions, documentation improvements etc. can be contributed via [issues](https://github.com/JeroenDelcour/tplot/issues) and/or [pull requests](https://github.com/JeroenDelcour/tplot/pulls).