From 40860ce5b8134618dad6457049d533aa211b0139 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 12 Feb 2020 14:44:28 +0100 Subject: define a style per allocator the style is named like the allocator and can be overwritten using a custom preamble. --- src/plots.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plots.py b/src/plots.py index 8a73fa0..8345181 100644 --- a/src/plots.py +++ b/src/plots.py @@ -484,6 +484,7 @@ def pgfplot_legend(bench, sumdir="", file_name="pgfplot_legend"): # define color rgb = matplotlib.colors.to_rgb(_get_alloc_color(bench, alloc_dict)) tex += f"\\providecolor{{{alloc_name}-color}}{{rgb}}{{{rgb[0]},{rgb[1]},{rgb[2]}}}\n" + tex += f"\\pgfplotsset{{{alloc_name}/.style={{color={alloc_name}-color}}}}\n\n" if src.globalvars.latex_custom_preamble: tex += src.globalvars.latex_custom_preamble + "\n" @@ -499,7 +500,7 @@ def pgfplot_legend(bench, sumdir="", file_name="pgfplot_legend"): addlegendimage_list = "" for alloc_name in allocators: alloc_list += f"{alloc_name}, " - addlegendimage_list += f"\t\\addlegendimage{{color={alloc_name}-color}}\n" + addlegendimage_list += f"\t\\addlegendimage{{{alloc_name}}}\n" tex += alloc_list[:-2] + "},\n]" tex += addlegendimage_list @@ -535,6 +536,7 @@ def pgfplot_linear(bench, perms, xexpr, yexpr, ylabel="y-label", xlabel="x-label # define color rgb = matplotlib.colors.to_rgb(_get_alloc_color(bench, alloc_dict)) tex += f"\\providecolor{{{alloc_name}-color}}{{rgb}}{{{rgb[0]},{rgb[1]},{rgb[2]}}}\n" + tex += f"\\pgfplotsset{{{alloc_name}/.style={{color={alloc_name}-color}}}}\n\n" if src.globalvars.latex_custom_preamble: tex += src.globalvars.latex_custom_preamble + "\n" @@ -556,8 +558,8 @@ f""" """ for alloc_name in allocators: - tex += f"\\addplot [{alloc_name}-color] table {{{alloc_name}.dat}};\n" - # tex += f"\t\\addplot table {{{alloc_name}.dat}};\n" + # tex += f"\\addplot [{alloc_name}-color] table {{{alloc_name}.dat}};\n" + tex += f"\t\\addplot+[{alloc_name}] table {{{alloc_name}.dat}};\n" tex +=\ """\\end{axis} -- cgit v1.2.3