Skip to content

Commit

Permalink
Merge pull request #15 from nschloe/no-label
Browse files Browse the repository at this point in the history
No label
  • Loading branch information
nschloe authored Mar 10, 2019
2 parents f3f1fbb + 20b8e56 commit 66bbc5e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ asciiplotlib provides many options for table plotting. For the most basic exampl
code
```python
import asciiplotlib as apl
import numpy

numpy.random.seed(0)
data = numpy.random.rand(5, 2)
Expand Down Expand Up @@ -93,6 +94,7 @@ for more examples.

```python
import asciiplotlib as apl
import numpy

numpy.random.seed(123)
sample = numpy.random.normal(size=1000)
Expand All @@ -110,6 +112,7 @@ produces

```python
import asciiplotlib as apl
import numpy

numpy.random.seed(123)
sample = numpy.random.normal(size=1000)
Expand All @@ -127,10 +130,10 @@ produces
asciiplotlib is [available from the Python Package
Index](https://pypi.org/project/asciiplotlib/), so simply do
```
pip install -U asciiplotlib
pip3 install -U asciiplotlib
```
to install or upgrade. Use `sudo -H` to install as root or the `--user` option
of `pip` to install in `$HOME`.
of `pip3` to install in `$HOME`.


### Testing
Expand Down
2 changes: 1 addition & 1 deletion asciiplotlib/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
__email__ = "nico.schloemer@gmail.com"
__copyright__ = u"Copyright (c) 2018-2019, {} <{}>".format(__author__, __email__)
__license__ = "License :: OSI Approved :: MIT License"
__version__ = "0.1.6"
__version__ = "0.1.7"
__status__ = "Development Status :: 4 - Beta"
2 changes: 2 additions & 0 deletions asciiplotlib/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def plot(
string = plot_command
if label:
string += " title '{}'".format(label)
else:
string += " notitle"

gnuplot_input.append(string)

Expand Down
27 changes: 26 additions & 1 deletion test/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,32 @@ def test_plot():
return


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

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

ref = """ 1 +---------------------------------------+
0.8 | ** ** |
0.6 | * ** |
0.4 | ** |
0.2 |* ** |
0 | ** |
| * |
-0.2 | ** ** |
-0.4 | ** * |
-0.6 | ** |
-0.8 | **** ** |
-1 +---------------------------------------+
0 1 2 3 4 5 6 7"""

assert string == ref
return


def test_plot_lim():
x = numpy.linspace(0, 2 * numpy.pi, 10)
y = numpy.sin(x)
Expand All @@ -48,7 +74,6 @@ def test_plot_lim():
title="header",
)
string = fig.get_string()
print(string)

ref = """ header
Expand Down

0 comments on commit 66bbc5e

Please sign in to comment.