https://github.com/bitromortac/plottoterminal
Plotting utility/library to print out a graph of xy data to the terminal.
https://github.com/bitromortac/plottoterminal
data-visualization mathematics plotting python3 terminal-based
Last synced: 11 days ago
JSON representation
Plotting utility/library to print out a graph of xy data to the terminal.
- Host: GitHub
- URL: https://github.com/bitromortac/plottoterminal
- Owner: bitromortac
- License: mit
- Created: 2020-09-07T16:15:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-11T05:20:10.000Z (over 5 years ago)
- Last Synced: 2025-12-15T13:36:28.441Z (4 months ago)
- Topics: data-visualization, mathematics, plotting, python3, terminal-based
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# plot*to*terminal
A plotting utility (library) for plotting data into the terminal encoded as
unicode characters as an xy graph, inspired by matplotlib. This tool doesn't
have any dependencies on gnuplot or numpy.
Supports:
* multi scatter plots
* automatic tick setting for linear scales
* automatic data rescaling to fit large numbers as tick labels
* axis labels
* unit labels
* command line interface for plotting xy data file (`$ plottoterminal file`)
Planned:
* command line interface for xy(z) data plotting
* bar plot
* legends
* z value heatmap
* color coding support
* custom marker styles
Example:
```python
import plottoterminal as ptt
import numpy as np
f = ptt.Figure(figsize=(57, 20))
xs = np.linspace(-10, 10, 200)
ys = xs ** 2
f.scatter(xs, ys)
ys2 = -xs ** 2
f.scatter(xs, ys2)
f.set_x_label("x")
f.set_y_label("x*x")
f.set_x_unit("m")
f.set_y_unit("m^2")
f.show()
```
Output:
```
1.0ᐃxx xx
×10^2 │ xx xx
[m^2] │ xxx xxx
│ xx xx
0.5├ xx xx
│ xxxx xxxx
│ xxx xxx
x │ xxxx xxxx
* 0.0├ *************
x │ **** ****
│ *** ***
│ **** ****
-0.5├ ** **
│ ** **
│ *** ***
│ ** **
-1.0├** **
└┴──────────┴──────────┴──────────┴──────────┴────ᐅ
-1.0 -0.5 0.0 0.5 1.0
x ×10^1 [m]
```
## Setup
Installing from source:
```shell script
git clone https://github.com/bitromortac/plottoterminal
cd plottoterminal
python3 -m pip install --user .
```
Installing from pypi:
```shell script
python3 -m pip install --user plottoterminal
```
## Command line usage
To plot a file composed of rows of x and y data separated by whitespace,
run the command `$ plottoterminal file.xy`.