Skip to content
Open
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
Next Next commit
add iterable obj processing as xs and ys arguments
  • Loading branch information
RustyC0der committed Apr 29, 2022
commit 67ddc91a399325f536193b696cec307d9160a729
6 changes: 4 additions & 2 deletions bashplotlib/scatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ def plot_scatter(f, xs, ys, size, pch, colour, title):
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
# try to convert any iterable data to list, so we can use any iterable object like pandas dataframe or numpy array
elif isiterable(xs) and isiterable(ys):
xs = [i for i in xs]
ys = [i for i in ys]
else:
with open(xs) as fh:
xs = [float(str(row).strip()) for row in fh]
Expand Down