Skip to content
Prev Previous commit
Next Next commit
allow colour input file
  • Loading branch information
sboysel committed Jan 10, 2016
commit f25053abf159a8b5ebc1f3aad8cdf77083375edc
7 changes: 6 additions & 1 deletion bashplotlib/scatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import csv
import sys
import optparse
from os.path import isfile
from .utils.helpers import *
from .utils.commandhelp import scatter

Expand Down Expand Up @@ -56,6 +57,10 @@ def plot_scatter(f, xs, ys, size, pch, colour, title):
else:
xs = [float(str(row).strip()) for row in open(xs)]
ys = [float(str(row).strip()) for row in open(ys)]
if isfile(colour):
cs = [str(row).strip() for row in open(colour)]
else:
cs = colour

plotted = set()

Expand All @@ -71,7 +76,7 @@ def plot_scatter(f, xs, ys, size, pch, colour, title):
if xp <= x and yp >= y and (xp, yp) not in plotted:
point = pch
plotted.add((xp, yp))
if cs:
if isinstance(cs, list):
colour = cs[i]
printcolour(point, True, colour)
print(" |")
Expand Down