From 0ca0a6087f977dbc932ec6a25b86562739f72f58 Mon Sep 17 00:00:00 2001 From: Felix Rios Date: Wed, 7 Feb 2024 09:36:50 +0100 Subject: [PATCH] Fixing coloring out of bounds --- src/cstrees/cstree.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cstrees/cstree.py b/src/cstrees/cstree.py index acec0da..53cb1d1 100644 --- a/src/cstrees/cstree.py +++ b/src/cstrees/cstree.py @@ -806,17 +806,13 @@ def sample_cstree(cards: list[int], max_cvars: int, prob_cvar: int, # Color each stage in the optimal staging. Singletons are black. # This should be done somewhere else probably. - colors = ['peru','blueviolet', 'orange', 'navy', 'rebeccapurple', 'darkseagreen', - 'darkslategray', 'lightslategray', 'aquamarine', - 'lightgoldenrodyellow', 'cornsilk', 'azure', 'chocolate', - 'red', 'darkolivegreen'] - + colors = ['peru','blueviolet', 'orange', 'navy', 'rebeccapurple', 'darkseagreen', 'aquamarine', 'goldenrodyellow', 'cornsilk', 'azure', 'chocolate', 'red', 'darkolivegreen', 'chartreuse', 'turquoise', 'olive', 'crimson', 'goldenrod', 'orchid', 'firebrick', 'lawngreen', 'deeppink', 'wheat', 'teal', 'mediumseagreen', 'salmon', 'palegreen', 'navajowhite', 'yellowgreen', 'mediumaquamarine', 'darkcyan', 'dodgerblue', 'brown', 'powderblue', 'mistyrose', 'violet', 'darkslategrey', 'midnightblue', 'aliceblue', 'dimgrey', 'palegoldenrod', 'black', 'darkgrey', 'olivedrab', 'linen', 'lightblue', 'thistle', 'greenyellow', 'indianred', 'khaki', 'lightslategrey', 'slateblue', 'purple', 'deepskyblue', 'magenta', 'yellow', 'ivory', 'darkorchid', 'mediumpurple', 'snow', 'dimgray', 'palevioletred', 'darkslateblue', 'sandybrown', 'lightgray', 'lemonchiffon', 'gray', 'silver', 'aqua', 'tomato', 'lightyellow', 'seagreen', 'darkmagenta', 'beige', 'cornflowerblue', 'peachpuff', 'ghostwhite', 'cyan', 'lightcoral', 'hotpink', 'lightpink', 'lightskyblue', 'slategrey', 'tan', 'oldlace', 'steelblue', 'springgreen', 'fuchsia', 'lime', 'papayawhip', 'mediumblue', 'mediumspringgreen', 'darkorange', 'lightgreen', 'blue', 'slategray', 'white', 'saddlebrown', 'mediumturquoise', 'paleturquoise', 'darkblue', 'plum', 'lightseagreen', 'lightgrey', 'blanchedalmond', 'lavenderblush', 'darkkhaki', 'gainsboro', 'lightsalmon', 'darkturquoise', 'moccasin', 'darkgoldenrod', 'mediumorchid', 'honeydew', 'mediumslateblue', 'maroon', 'forestgreen', 'darkgray', 'floralwhite', 'darkgreen', 'lightcyan', 'darksalmon', 'pink', 'royalblue', 'sienna', 'green', 'orangered', 'bisque', 'antiquewhite', 'rosybrown', 'whitesmoke', 'darkred', 'burlywood', 'skyblue', 'mediumvioletred', 'mintcream', 'limegreen', 'lightsteelblue', 'grey', 'coral', 'indigo', 'gold', 'cadetblue'] for level, staging in stagings.items(): for i, stage in enumerate(staging): if (level==-1) or ((level>0) and all([isinstance(i, int) for i in stage.list_repr])): stage.color = "black" else: - stage.color = colors[i] + stage.color = colors[i % len(colors)] ct.update_stages(stagings)