Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bashplotlib/scatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
"""
Expand Down
6 changes: 3 additions & 3 deletions bashplotlib/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 19 additions & 0 deletions scratch.py
Original file line number Diff line number Diff line change
@@ -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)