Skip to content

Commit 67ddc91

Browse files
author
RustyC0der
committed
add iterable obj processing as xs and ys arguments
1 parent db4065c commit 67ddc91

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

bashplotlib/scatterplot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ def plot_scatter(f, xs, ys, size, pch, colour, title):
7373
ys = [float(i[1]) for i in data]
7474
if len(data[0]) > 2:
7575
cs = [i[2].strip() for i in data]
76-
elif isinstance(xs, list) and isinstance(ys, list):
77-
pass
76+
# try to convert any iterable data to list, so we can use any iterable object like pandas dataframe or numpy array
77+
elif isiterable(xs) and isiterable(ys):
78+
xs = [i for i in xs]
79+
ys = [i for i in ys]
7880
else:
7981
with open(xs) as fh:
8082
xs = [float(str(row).strip()) for row in fh]

0 commit comments

Comments
 (0)