summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-12 15:04:55 +0100
committerwm4 <wm4@nowhere>2016-01-12 15:04:55 +0100
commit81f3b3aafe72e5ca9ac79d29246e70dce76ebca9 (patch)
treea485a01c6117db4f3623e938770392a643b715eb /TOOLS
parent796d5266f1dce41ac6026a5ac4314ab7634e04af (diff)
downloadmpv-81f3b3aafe72e5ca9ac79d29246e70dce76ebca9.tar.bz2
mpv-81f3b3aafe72e5ca9ac79d29246e70dce76ebca9.tar.xz
TOOLS/stats-conv: slightly better color
pyqtgraph's intColor() is less than ideal, especially on white background. Can't see anything. Unfortunately the rendering of the legend can't be fixed, because pyqtgraph is terrible and hardcodes its rendering, including colors.
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/stats-conv.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/TOOLS/stats-conv.py b/TOOLS/stats-conv.py
index e0b168d541..120f69195a 100755
--- a/TOOLS/stats-conv.py
+++ b/TOOLS/stats-conv.py
@@ -40,7 +40,7 @@ class G:
events = {}
start = None
markers = ["o", "s", "t", "d"]
- curveno = 0
+ curveno = {}
def find_marker():
if len(G.markers) == 0:
@@ -66,6 +66,10 @@ def get_event(event, evtype):
G.events[event] = e
return G.events[event]
+colors = [(0.0, 0.5, 0.0), (0.0, 0.0, 1.0), (0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.75, 0.75, 0), (0.0, 0.75, 0.75), (0.75, 0, 0.75)]
+def mkColor(t):
+ return pg.mkColor(int(t[0] * 255), int(t[1] * 255), int(t[2] * 255))
+
SCALE = 1e6 # microseconds to seconds
for line in [line.split("#")[0].strip() for line in open(filename, "r")]:
@@ -152,8 +156,10 @@ for e in G.sevents:
args['symbol'] = e.marker
args['pen'] = None
else:
- args['pen'] = pg.mkPen(pg.intColor(G.curveno), width=0)
- G.curveno += 1
+ if not cur in G.curveno:
+ G.curveno[cur] = 0
+ args['pen'] = pg.mkPen(mkColor(colors[G.curveno[cur] % len(colors)]), width=0)
+ G.curveno[cur] += 1
n = cur.plot([x for x,y in e.vals], [y for x,y in e.vals], **args)
QtGui.QApplication.instance().exec_()