Skip to content
Next Next commit
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
  • Loading branch information
GregoryAshton committed Oct 7, 2015
commit 1517bf98694c55628e864b31e125a2c3831fe411
12 changes: 3 additions & 9 deletions bashplotlib/scatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def get_scale(series, is_y=False, steps=20):
min_val = min(series)
max_val = max(series)
scaled_series = []
for x in drange(min_val, max_val, (max_val - min_val) / steps):
for x in drange(min_val, max_val, (max_val - min_val) / steps,
include_stop=True):
if x > 0 and scaled_series and max(scaled_series) < 0:
scaled_series.append(0.0)
scaled_series.append(x)
Expand Down Expand Up @@ -65,16 +66,9 @@ def plot_scatter(f, xs, ys, size, pch, colour, title):
for (i, (xp, yp)) in enumerate(zip(xs, ys)):
if xp <= x and yp >= y and (xp, yp) not in plotted:
point = pch
#point = str(i)
plotted.add((xp, yp))
if x == 0 and y == 0:
point = "o"
elif x == 0:
point = "|"
elif y == 0:
point = "-"
printcolour(point, True, colour)
print("|")
print(" |")
print("-" * (2 * len(get_scale(xs, False, size)) + 2))


Expand Down