From: Tom Clegg Date: Wed, 12 Oct 2022 18:36:33 +0000 (-0400) Subject: 19524: Fix colormap. X-Git-Url: https://git.arvados.org/lightning.git/commitdiff_plain/20ea031038bb7c2977dc210a71865d2e7e9b7454?hp=2d74c86d6ed14a863fd7a05f526a6b68a747123f 19524: Fix colormap. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/plot.go b/plot.go index 1d80e8a21c..aa4335fec6 100644 --- a/plot.go +++ b/plot.go @@ -78,17 +78,19 @@ X = scipy.load(infile) colors = None if sys.argv[2]: + samples = [] labels = {} with open(sys.argv[2], 'rt') as samplelist: for row in csv.reader(samplelist): - labels[row[1]] = '---' + id = row[1] + samples.append(id) with open(sys.argv[3], 'rt') as colormap: for row in csv.reader(colormap): - ident=row[0] - label=row[1] - for fnm in labels: - if row[0] in fnm: - labels[fnm] = row[1] + tag = row[0] + label = row[1] + for id in samples: + if tag in id: + labels[id] = label colors = [] labelcolors = { 'PUR': 'firebrick', @@ -118,9 +120,9 @@ if sys.argv[2]: 'GIH': 'blueviolet', 'PJL': 'blueviolet', } - for fnm in sorted(labels.keys()): - if labels[fnm] in labelcolors: - colors.append(labelcolors[labels[fnm]]) + for id in samples: + if (id in labels) and (labels[id] in labelcolors): + colors.append(labelcolors[labels[id]]) else: colors.append('black')