summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-06-17 23:36:19 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-06-17 23:36:19 +0200
commit7ee40de699d117ef01bf0fab89a95e2a696b70b4 (patch)
treed859286153970faceb8514cbad621c9ab2112c3f
parenteaf53188ae0c8c4311052d3c68a73c7b03f2be9c (diff)
downloadscripts-7ee40de699d117ef01bf0fab89a95e2a696b70b4.tar.gz
rare/interrupts-graph.py: use different colors
There are often more than 8 lines, use a different set of colors in an attempt to improve recognition.
-rwxr-xr-xrare/interrupts-graph.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/rare/interrupts-graph.py b/rare/interrupts-graph.py
index 88167c2..dce9316 100755
--- a/rare/interrupts-graph.py
+++ b/rare/interrupts-graph.py
@@ -27,6 +27,19 @@ SMOOTH_CURVES = True
MARKER_DEFAULT = 'o'
MARKER_SELECTED = 'v'
+# 26 colors from http://graphicdesign.stackexchange.com/a/3815
+# "A Colour Alphabet and the Limits of Colour Coding"
+COLORS = ['#F0A3FF', '#0075DC', '#993F00', '#4C005C', '#191919', '#005C31',
+'#2BCE48', '#FFCC99', '#808080', '#94FFB5', '#8F7C00', '#9DCC00', '#C20088',
+'#003380', '#FFA405', '#FFA8BB', '#426600', '#FF0010', '#5EF1F2', '#00998F',
+'#E0FF66', '#740AFF', '#990000', '#FFFF80', '#FFFF00', '#FF5005']
+# From alex440's comment (currently not used)
+ALT_COLORS = ['#023FA5', '#7D87B9', '#BEC1D4', '#D6BCC0', '#BB7784', '#FFFFFF',
+'#4A6FE3', '#8595E1', '#B5BBE3', '#E6AFB9', '#E07B91', '#D33F6A', '#11C638',
+'#8DD593', '#C6DEC7', '#EAD3C6', '#F0B98D', '#EF9708', '#0FCFC0', '#9CDED6',
+'#D5EAE7', '#F3E1EB', '#F6C4E1', '#F79CD4']
+
+
def is_line_ok(name, yvalues):
"""Returns True if a line should be displayed for this name."""
if max(yvalues) < 5:
@@ -148,7 +161,10 @@ def update():
if name in lines:
lines[name].set_data(xdata, ydata)
else:
- lines[name], = plt.plot(xdata, ydata, MARKER_DEFAULT, label=name)
+ color = COLORS[names.index(name) % len(COLORS)]
+ lines[name], = plt.plot(xdata, ydata, MARKER_DEFAULT,
+ label=name,
+ color=color)
lines[name].set_picker(5) # Make selectable
update_legend = True