Skip to content

Commit

Permalink
Merge pull request #38 from nschloe/scatter
Browse files Browse the repository at this point in the history
Scatter
  • Loading branch information
nschloe authored Mar 27, 2020
2 parents a17eea3 + a322f51 commit 9827634
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = termplotlib
version = 0.2.4
version = 0.3.0
author = Nico Schlömer
email = [email protected]
description = Plotting on the command line
Expand Down
34 changes: 34 additions & 0 deletions test/test_scatter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import numpy

import termplotlib as tpl


def test_scatter():
numpy.random.seed(0)
x = numpy.arange(0.0, 50.0, 2.0)
y = x ** 1.3 + numpy.random.rand(*x.shape) * 30.0

fig = tpl.figure()
fig.plot(x, y, plot_command="plot '-' w points", width=50, height=15)
# fig.show()
string = fig.get_string()

ref = """ 180 +---------------------------------------+
160 | AA |
140 | A A AA |
| A A |
120 | |
100 | A A |
80 | A A A |
60 | A A A A |
| A |
40 | AA A A |
20 | AA |
0 +---------------------------------------+
0 5 10 15 20 25 30 35 40 45 50"""

assert string == ref


if __name__ == "__main__":
test_scatter()

0 comments on commit 9827634

Please sign in to comment.