diff --git a/bashplotlib/scatterplot.py b/bashplotlib/scatterplot.py index 76d20e4..2a8bef8 100644 --- a/bashplotlib/scatterplot.py +++ b/bashplotlib/scatterplot.py @@ -34,7 +34,7 @@ def _plot_scatter(xs, ys, size, pch, colour, title, cs): if title: print(box_text(title, 2 * len(get_scale(xs, False, size)) + 1)) - print("-" * (2 * len(get_scale(xs, False, size)) + 2)) + print("+" + "-" * (2 * len(get_scale(xs, False, size)) + 3) + "+") for y in get_scale(ys, True, size): print("|", end=' ') for x in get_scale(xs, False, size): @@ -46,8 +46,8 @@ def _plot_scatter(xs, ys, size, pch, colour, title, cs): if cs: colour = cs[i] printcolour(point, True, colour) - print(" |") - print("-" * (2 * len(get_scale(xs, False, size)) + 2)) + print(" "*(size+4) + "|") + print("+" + "-" * (2 * len(get_scale(xs, False, size)) + 3) + "+") def plot_scatter(f, xs, ys, size, pch, colour, title): """ diff --git a/bashplotlib/utils/helpers.py b/bashplotlib/utils/helpers.py index 8b37cf5..6865f6d 100644 --- a/bashplotlib/utils/helpers.py +++ b/bashplotlib/utils/helpers.py @@ -82,7 +82,7 @@ def box_text(text, width, offset=0): """ Return text inside an ascii textbox """ - box = " " * offset + "-" * (width+2) + "\n" - box += " " * offset + "|" + text.center(width) + "|" + "\n" - box += " " * offset + "-" * (width+2) + box = " " * offset + "+" + "-" * (width+2) + "+" "\n" + box += " " * offset + "|" + text.center(width+2) + "|" + "\n" + box += " " * offset + "+" + "-" * (width+2) + "+" return box diff --git a/scratch.py b/scratch.py new file mode 100644 index 0000000..cd37262 --- /dev/null +++ b/scratch.py @@ -0,0 +1,19 @@ +# scratch.py +from bashplotlib.scatterplot import plot_scatter + +x_coords = [-10,20,30] +y_coords = [-10,20,30] +width = 10 +char = 'x' +color = 'green' +title = 'My Test Graph' + +plot_scatter( + None, + x_coords, + y_coords, + width, + char, + color, + title) +