Skip to content

Commit

Permalink
rename to termiplot
Browse files Browse the repository at this point in the history
  • Loading branch information
nschloe committed Mar 10, 2019
1 parent 66bbc5e commit 4779de9
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 73 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- run: pip3 install .
- run: pip3 install -r test_requirements.txt
# format and lint
- run: LC_ALL=C.UTF-8 black --check setup.py asciiplotlib/ test/*.py
- run: flake8 setup.py asciiplotlib/ test/*.py
- run: LC_ALL=C.UTF-8 black --check setup.py termiplot/ test/*.py
- run: flake8 setup.py termiplot/ test/*.py
# The tests
- run: cd test/ && MPLBACKEND=Agg pytest --cov asciiplotlib
- run: cd test/ && MPLBACKEND=Agg pytest --cov termiplot
# submit to codecov
- run: apt-get install -y curl
- run: bash <(curl -s https://codecov.io/bash) -R ~/work
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=$(shell python3 -c "import asciiplotlib; print(asciiplotlib.__version__)")
VERSION=$(shell python3 -c "import termiplot; print(termiplot.__version__)")

default:
@echo "\"make publish\"?"
Expand All @@ -24,8 +24,8 @@ clean:
@rm -rf *.egg-info/ build/ dist/ MANIFEST .pytest_cache/

lint:
black --check setup.py asciiplotlib/ test/*.py
flake8 setup.py asciiplotlib/ test/*.py
black --check setup.py termiplot/ test/*.py
flake8 setup.py termiplot/ test/*.py

black:
black setup.py asciiplotlib/ test/*.py
black setup.py termiplot/ test/*.py
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# asciiplotlib
# termiplot

[![CircleCI](https://img.shields.io/circleci/project/github/nschloe/asciiplotlib/master.svg)](https://circleci.com/gh/nschloe/asciiplotlib)
[![codecov](https://img.shields.io/codecov/c/github/nschloe/asciiplotlib.svg)](https://codecov.io/gh/nschloe/asciiplotlib)
[![CircleCI](https://img.shields.io/circleci/project/github/nschloe/termiplot/master.svg)](https://circleci.com/gh/nschloe/termiplot)
[![codecov](https://img.shields.io/codecov/c/github/nschloe/termiplot.svg)](https://codecov.io/gh/nschloe/termiplot)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![PyPi Version](https://img.shields.io/pypi/v/asciiplotlib.svg)](https://pypi.org/project/asciiplotlib)
[![GitHub stars](https://img.shields.io/github/stars/nschloe/asciiplotlib.svg?logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/asciiplotlib)
[![PyPi Version](https://img.shields.io/pypi/v/termiplot.svg)](https://pypi.org/project/termiplot)
[![GitHub stars](https://img.shields.io/github/stars/nschloe/termiplot.svg?logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/termiplot)

asciiplotlib is a Python 3 library for all your terminal plotting needs. It aims to work
termiplot is a Python 3 library for all your terminal plotting needs. It aims to work
like [matplotlib](https://matplotlib.org/).


### Line plots

For line plots, asciiplotlib relies on [gnuplot](http://www.gnuplot.info/). With that installed, the code
For line plots, termiplot relies on [gnuplot](http://www.gnuplot.info/). With that installed, the code
```python
import asciiplotlib as apl
import termiplot as tp
import numpy

x = numpy.linspace(0, 2 * numpy.pi, 10)
y = numpy.sin(x)

fig = apl.figure()
fig = tp.figure()
fig.plot(x, y, label="data", width=50, height=15)
fig.show()
```
Expand All @@ -44,34 +44,34 @@ produces

### Tables

asciiplotlib provides many options for table plotting. For the most basic example, the
termiplot provides many options for table plotting. For the most basic example, the
code
```python
import asciiplotlib as apl
import termiplot as tp
import numpy

numpy.random.seed(0)
data = numpy.random.rand(5, 2)

fig = apl.figure()
fig = tp.figure()
fig.table(data)
fig.show()
```
produces

![table1](https://nschloe.github.io/asciiplotlib/table1.png)
![table1](https://nschloe.github.io/termiplot/table1.png)

You can control border style, padding, alignment, and various other attributes. For
example,
```python
import asciiplotlib as apl
import termiplot as tp

data = [
[["a", "bb", "ccc"]],
[[1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]],
]

fig = apl.figure()
fig = tp.figure()
fig.table(data, border_style="thin", force_ascii=True, padding=(0, 1), alignment="lcr")
fig.show()
```
Expand All @@ -86,59 +86,59 @@ produces
+-----------------+-----------------+-----------------+
```
See
[`test/test_table.py`](https://github.com/nschloe/asciiplotlib/blob/master/test/test_table.py)
[`test/test_table.py`](https://github.com/nschloe/termiplot/blob/master/test/test_table.py)
for more examples.


### Horizontal histograms

```python
import asciiplotlib as apl
import termiplot as tp
import numpy

numpy.random.seed(123)
sample = numpy.random.normal(size=1000)
counts, bin_edges = numpy.histogram(sample)

fig = apl.figure()
fig = tp.figure()
fig.hist(counts, bin_edges, orientation="horizontal", force_ascii=False)
fig.show()
```
produces

![hist1](https://nschloe.github.io/asciiplotlib/hist1.png)
![hist1](https://nschloe.github.io/termiplot/hist1.png)

### Vertical histograms

```python
import asciiplotlib as apl
import termiplot as tp
import numpy

numpy.random.seed(123)
sample = numpy.random.normal(size=1000)
counts, bin_edges = numpy.histogram(sample, bins=40)
fig = apl.figure()
fig = tp.figure()
fig.hist(counts, bin_edges, grid=[15, 25], force_ascii=False)
fig.show()
```
produces

![hist2](https://nschloe.github.io/asciiplotlib/hist2.png)
![hist2](https://nschloe.github.io/termiplot/hist2.png)

### Installation

asciiplotlib is [available from the Python Package
Index](https://pypi.org/project/asciiplotlib/), so simply do
termiplot is [available from the Python Package
Index](https://pypi.org/project/termiplot/), so simply do
```
pip3 install -U asciiplotlib
pip3 install -U termiplot
```
to install or upgrade. Use `sudo -H` to install as root or the `--user` option
of `pip3` to install in `$HOME`.


### Testing

To run the asciiplotlib unit tests, check out this repository and type
To run the termiplot unit tests, check out this repository and type
```
pytest
```
Expand All @@ -155,4 +155,4 @@ To create a new release

### License

asciiplotlib is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).
termiplot is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# https://packaging.python.org/single_source_version/
base_dir = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(base_dir, "asciiplotlib", "__about__.py"), "rb") as f:
with open(os.path.join(base_dir, "termiplot", "__about__.py"), "rb") as f:
exec(f.read(), about)


Expand All @@ -17,10 +17,10 @@ def read(fname):


setup(
name="asciiplotlib",
name="termiplot",
version=about["__version__"],
packages=find_packages(),
url="https://github.com/nschloe/asciiplotlib",
url="https://github.com/nschloe/termiplot",
author=about["__author__"],
author_email=about["__email__"],
install_requires=[],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions test/test_figure.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# -*- coding: utf-8 -*-
#
import asciiplotlib as apl
import termiplot as tp


def test_simple():
fig = apl.figure()
fig = tp.figure()
fig.aprint("abc")
string = fig.get_string()
assert string == """abc"""
return


def test_padding_1():
fig = apl.figure(padding=1)
fig = tp.figure(padding=1)
fig.aprint("abc")
string = fig.get_string()
assert (
Expand All @@ -25,7 +25,7 @@ def test_padding_1():


def test_padding_1b():
fig = apl.figure(padding=(1,))
fig = tp.figure(padding=(1,))
fig.aprint("abc")
string = fig.get_string()
assert (
Expand All @@ -38,7 +38,7 @@ def test_padding_1b():


def test_padding_2():
fig = apl.figure(padding=(1, 2))
fig = tp.figure(padding=(1, 2))
fig.aprint("abc")
string = fig.get_string()
assert (
Expand All @@ -51,7 +51,7 @@ def test_padding_2():


def test_padding_3():
fig = apl.figure(padding=(1, 2, 3))
fig = tp.figure(padding=(1, 2, 3))
fig.aprint("abc")
string = fig.get_string()
assert (
Expand All @@ -66,7 +66,7 @@ def test_padding_3():


def test_padding_4():
fig = apl.figure(padding=(1, 2, 3, 4))
fig = tp.figure(padding=(1, 2, 3, 4))
fig.aprint("abc")
string = fig.get_string()
assert (
Expand Down
14 changes: 7 additions & 7 deletions test/test_hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy
import pytest

import asciiplotlib as apl
import termiplot as tp


@pytest.mark.skipif(
Expand All @@ -16,7 +16,7 @@ def test_horizontal():
numpy.random.seed(123)
sample = numpy.random.normal(size=1000)
counts, bin_edges = numpy.histogram(sample)
fig = apl.figure()
fig = tp.figure()
fig.hist(counts, bin_edges, orientation="horizontal")
# fig.show()
string = fig.get_string()
Expand All @@ -43,7 +43,7 @@ def test_horizontal_ascii():
numpy.random.seed(123)
sample = numpy.random.normal(size=1000)
counts, bin_edges = numpy.histogram(sample)
fig = apl.figure()
fig = tp.figure()
fig.hist(counts, bin_edges, orientation="horizontal", force_ascii=True)
string = fig.get_string()

Expand Down Expand Up @@ -73,7 +73,7 @@ def test_vertical():
numpy.random.seed(123)
sample = numpy.random.normal(size=1000)
counts, bin_edges = numpy.histogram(sample, bins=40)
fig = apl.figure()
fig = tp.figure()
fig.hist(counts, bin_edges)
fig.show()

Expand Down Expand Up @@ -101,7 +101,7 @@ def test_vertical_ascii():
numpy.random.seed(123)
sample = numpy.random.normal(size=1000)
counts, bin_edges = numpy.histogram(sample, bins=40)
fig = apl.figure()
fig = tp.figure()
fig.hist(counts, bin_edges, force_ascii=True)
# fig.show()

Expand Down Expand Up @@ -133,7 +133,7 @@ def test_vertical_grid():
numpy.random.seed(123)
sample = numpy.random.normal(size=1000)
counts, bin_edges = numpy.histogram(sample, bins=40)
fig = apl.figure()
fig = tp.figure()
fig.hist(counts, bin_edges, grid=[15, 25])
# fig.show()
string = fig.get_string()
Expand Down Expand Up @@ -164,7 +164,7 @@ def test_vertical_strip():
numpy.random.seed(20)
sample = numpy.random.normal(size=10000)
counts, bin_edges = numpy.histogram(sample)
fig = apl.figure()
fig = tp.figure()
fig.hist(counts, bin_edges, grid=[5, 8], strip=True)
string = fig.get_string()

Expand Down
8 changes: 4 additions & 4 deletions test/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#
import numpy

import asciiplotlib as apl
import termiplot as tp


def test_plot():
x = numpy.linspace(0, 2 * numpy.pi, 10)
y = numpy.sin(x)

fig = apl.figure()
fig = tp.figure()
fig.plot(x, y, label="data", width=50, height=15)
string = fig.get_string()

Expand All @@ -35,7 +35,7 @@ def test_nolabel():
x = numpy.linspace(0, 2 * numpy.pi, 10)
y = numpy.sin(x)

fig = apl.figure()
fig = tp.figure()
fig.plot(x, y, width=50, height=15)
string = fig.get_string()

Expand All @@ -61,7 +61,7 @@ def test_plot_lim():
x = numpy.linspace(0, 2 * numpy.pi, 10)
y = numpy.sin(x)

fig = apl.figure()
fig = tp.figure()
fig.plot(
x,
y,
Expand Down

0 comments on commit 4779de9

Please sign in to comment.