Skip to content

Commit 1517bf9

Browse files
committed
Improves the setting of xlims in the scatter plot
* Fixes a bug in which the right-most data point is not includes by using the `drange` include_stop argument * Removes unneccersery code that is repeating the operation of plotting a border * Add a space between the final data point and the right-hand border
1 parent 51b05e6 commit 1517bf9

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

bashplotlib/scatterplot.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def get_scale(series, is_y=False, steps=20):
1717
min_val = min(series)
1818
max_val = max(series)
1919
scaled_series = []
20-
for x in drange(min_val, max_val, (max_val - min_val) / steps):
20+
for x in drange(min_val, max_val, (max_val - min_val) / steps,
21+
include_stop=True):
2122
if x > 0 and scaled_series and max(scaled_series) < 0:
2223
scaled_series.append(0.0)
2324
scaled_series.append(x)
@@ -65,16 +66,9 @@ def plot_scatter(f, xs, ys, size, pch, colour, title):
6566
for (i, (xp, yp)) in enumerate(zip(xs, ys)):
6667
if xp <= x and yp >= y and (xp, yp) not in plotted:
6768
point = pch
68-
#point = str(i)
6969
plotted.add((xp, yp))
70-
if x == 0 and y == 0:
71-
point = "o"
72-
elif x == 0:
73-
point = "|"
74-
elif y == 0:
75-
point = "-"
7670
printcolour(point, True, colour)
77-
print("|")
71+
print(" |")
7872
print("-" * (2 * len(get_scale(xs, False, size)) + 2))
7973

8074

0 commit comments

Comments
 (0)