Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Merge branch 'master' into master
  • Loading branch information
glamp authored Jan 2, 2019
commit 1e05ddd2bdc602bea63881857cbbfa1f4153bed2
13 changes: 8 additions & 5 deletions bashplotlib/scatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,21 @@ def plot_scatter(f, xs, ys, size, pch, colour, title):
cs = None
if f:
if isinstance(f, str):
f = open(f)

data = [tuple(line.strip().split(',')) for line in f]
with open(f) as fh:
data = [tuple(line.strip().split(',')) for line in fh]
else:
data = [tuple(line.strip().split(',')) for line in f]
xs = [float(i[0]) for i in data]
ys = [float(i[1]) for i in data]
if len(data[0]) > 2:
cs = [i[2].strip() for i in data]
elif isinstance(xs, list) and isinstance(ys, list):
pass
else:
xs = [float(str(row).strip()) for row in open(xs)]
ys = [float(str(row).strip()) for row in open(ys)]
with open(xs) as fh:
xs = [float(str(row).strip()) for row in fh]
with open(ys) as fh:
ys = [float(str(row).strip()) for row in fh]

_plot_scatter(xs, ys, size, pch, colour, title, cs)

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.