https://github.com/linkedin/asciietch
A graphing library with the goal of making it simple to graphs using ascii characters.
https://github.com/linkedin/asciietch
Last synced: 10 months ago
JSON representation
A graphing library with the goal of making it simple to graphs using ascii characters.
- Host: GitHub
- URL: https://github.com/linkedin/asciietch
- Owner: linkedin
- License: bsd-2-clause
- Created: 2017-11-29T20:43:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-10-07T21:58:50.000Z (over 4 years ago)
- Last Synced: 2025-07-19T22:39:03.616Z (11 months ago)
- Language: Python
- Size: 266 KB
- Stars: 139
- Watchers: 18
- Forks: 18
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Ascii Etch [](https://opensource.org/licenses/BSD-2-Clause) [](https://travis-ci.org/linkedin/asciietch) [](https://coveralls.io/github/linkedin/asciietch)
A graphing library with the goal of making it simple to graph series of numbers using ascii characters.
## Quick Start
To start using Ascii Etch ensure Python 3.6 or higher is installed. Then install asciietch using pip3.6 or higher:
```
pip3 install asciietch
```
Then import asciietch and begin using it.
## Examples
### Graphing 0-4 values as a line graph
```python
>>> from asciietch.graph import Grapher
>>> g = Grapher()
>>> values = [0, 1, 2, 3, 4]
>>> print(g.asciigraph(values))
-
/
/
/
/
```
### Graphing 0-4 values as a histogram
```python
>>> from asciietch.graph import Grapher
>>> g = Grapher()
>>> values = [0, 1, 2, 3, 4]
>>> print(g.asciihist(values))
▁▃▅▆█
```
### Graphing more values
```python
>>> from asciietch.graph import Grapher
>>> g = Grapher()
>>> values = [0, 1, 2, 3, 4, 4, 3, 2, 1, 2, 2, 2]
>>> print(g.asciigraph(values))
--
/ \
/ \ ---
/ -
/
>>> print(g.asciihist(values))
▁▃▅▆██▆▅▃▅▅▅
```
### Graphing a large set of values and adding labels
```python
>>> import random
>>> from asciietch.graph import Grapher
>>> g = Grapher()
>>> values = []
>>> v = 0
>>> for i in range(1000):
... v = v + random.randint(-1, 1)
... values.append(v)
>>> print(g.asciigraph(values, max_height=10, max_width=100, label=True))
```
```
Upper value: 147.6 *********************************************************************************
-------- ---
----/ - \- -
----/ \----/ \--
-/ \
---- ----/ \------ - ----
\------/ \----/ \/ \-
\--
\-------
\------
\- -
\-/
Lower value: 85.3 ********************************************* Mean: 122.196 *** Std Dev: 16.20 ***
```
## Developing
```sh
git clone git@github.com:linkedin/asciietch.git
cd asciietch
python3 setup.py venv
source activate
python3 setup.py develop
```
## Testing
```sh
pip3.6 install tox
tox
```
## Contributing Code
Contributions are welcome, see [Contribution guidelines for this project](CONTRIBUTING.md)