From 768aa90a002a46b8f71157b909a68f845585416a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 7 Jun 2017 19:45:14 +0200 Subject: first commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- plot | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 plot (limited to 'plot') diff --git a/plot b/plot new file mode 100755 index 0000000..97bf34c --- /dev/null +++ b/plot @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 + +import sys, math +import matplotlib.pyplot as plot + +#plot.xkcd() +fig = plot.figure(figsize = (3 * 2, 4 * 2)) +data = sys.stdin.read().split('\n') + +graphs = {} +points = set() +values = set() + +for line in data: + if line == '': + continue + while ' ' in line: + line = line.replace(' ', ' ') + [label, point, time] = line.split(' ') + [_, point] = point.split('<<') + point = int(point) + time = float(time) / 10 + if label not in graphs: + graphs[label] = {} + graphs[label][point] = time + points.add(point) + values.add(time) + +points = sorted(list(points)) +values = sorted(list(values)) + +for label in sorted(graphs.keys()): + graph_values = list(map(lambda x : x[1], sorted(graphs[label].items(), key = lambda x : x[0]))) + plot.plot(points, graph_values, label = label) + +plot.xticks(points, map(str, points)) +fig.suptitle('pipe(7) versus unix(7)') +plot.ylabel('millisecond') +plot.xlabel('log₂(n)') +plot.grid(axis = 'x', linestyle = ' ') +plot.legend(loc = 'upper left') +plot.xlim((min(points), max(points))) +plot.ylim((min(values) * 1.05, max(values) * 1.05)) +plot.grid(True) +plot.savefig('graph.svg', transparent = False, format = 'svg') -- cgit v1.2.3-70-g09d2