diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2020-02-11 12:32:37 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2020-02-11 12:32:37 +0100 |
| commit | 3fd6859acb4aacec84e8eba8c30f11fa6edb265c (patch) | |
| tree | 645e44a65725b210ad8ec7ab6fa2f4409c040ec2 | |
| parent | 70d464b53602d4b4f22e7256aba0bc12d7addd8f (diff) | |
| download | allocbench-3fd6859acb4aacec84e8eba8c30f11fa6edb265c.tar.gz allocbench-3fd6859acb4aacec84e8eba8c30f11fa6edb265c.zip | |
use allocbench colors in pgfplot
the used colors consist of the allocator name followed by '_color'.
The colors are defined using xcolors providecolor command which does not
override existing names.
| -rw-r--r-- | src/benchmark.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/benchmark.py b/src/benchmark.py index c572618..29442d1 100644 --- a/src/benchmark.py +++ b/src/benchmark.py @@ -9,6 +9,7 @@ import os import subprocess from time import sleep +import matplotlib import matplotlib.pyplot as plt import numpy as np @@ -983,16 +984,21 @@ class Benchmark: s =\ """\\documentclass{standalone} \\usepackage{pgfplots} +\\usepackage{xcolor} """ - for alloc in allocators: - s += f"\\begin{{filecontents*}}{{{alloc}.dat}}\n" + for alloc_name, alloc_dict in allocators.items(): + s += f"\\begin{{filecontents*}}{{{alloc_name}.dat}}\n" for i, perm in enumerate(perms): - x = self._eval_with_stat(xval, alloc, perm, "mean") - y = self._eval_with_stat(yval, alloc, perm, "mean") + x = self._eval_with_stat(xval, alloc_name, perm, "mean") + y = self._eval_with_stat(yval, alloc_name, perm, "mean") s += f"{x} {y}\n" s += "\\end{filecontents*}\n" + # define color + rgb = matplotlib.colors.to_rgb(alloc_dict["color"]) + s += f"\\providecolor{{{alloc_name}-color}}{{rgb}}{{{rgb[0]},{rgb[1]},{rgb[2]}}}\n" + s +=\ f""" \\begin{{document}} @@ -1004,9 +1010,9 @@ f""" ] """ - for alloc in allocators: - # s += f"\\addplot [color{i}] table {{{alloc_name}.dat}}" - s += f"\t\\addplot table {{{alloc}.dat}};\n" + for alloc_name in allocators: + s += f"\\addplot [{alloc_name}-color] table {{{alloc_name}.dat}};\n" + # s += f"\t\\addplot table {{{alloc_name}.dat}};\n" s +=\ """\\end{axis} |
