aboutsummaryrefslogtreecommitdiff
path: root/src/benchmark.py
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-11-28 14:37:57 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-11-28 14:37:57 +0100
commitee3d921b2d73ec90f3a423016f97210ede4781d9 (patch)
treeb441f800591fd86c5e2ff6268eba10fb9565f1d3 /src/benchmark.py
parent53ac585bea0a606e39e4d87a917732f506757150 (diff)
downloadallocbench-ee3d921b2d73ec90f3a423016f97210ede4781d9.tar.gz
allocbench-ee3d921b2d73ec90f3a423016f97210ede4781d9.zip
support tikz plot using tikzplotlib
Diffstat (limited to 'src/benchmark.py')
-rw-r--r--src/benchmark.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/benchmark.py b/src/benchmark.py
index 15c4fee..cbc59eb 100644
--- a/src/benchmark.py
+++ b/src/benchmark.py
@@ -612,7 +612,12 @@ class Benchmark:
plt.xlabel(eval(xlabel))
plt.ylabel(eval(ylabel))
plt.title(eval(title))
- plt.savefig(os.path.join(sumdir, ".".join([self.name, filepostfix, file_ext])))
+ figname = os.path.join(sumdir, f"{self.name}.{filepostfix}.{file_ext}")
+ if figname.endswith(".tex"):
+ import tikzplotlib
+ tikzplotlib.save(figname)
+ else:
+ plt.savefig(figname)
plt.clf()
def barplot_single_arg(self, yval, ylabel="'y-label'", xlabel="'x-label'",
@@ -661,7 +666,12 @@ class Benchmark:
plt.xlabel(eval(xlabel))
plt.ylabel(eval(ylabel))
plt.title(eval(title))
- plt.savefig(os.path.join(sumdir, ".".join([self.name, filepostfix, file_ext])))
+ figname = os.path.join(sumdir, f"{self.name}.{filepostfix}.{file_ext}")
+ if figname.endswith(".tex"):
+ import tikzplotlib
+ tikzplotlib.save(figname)
+ else:
+ plt.savefig(figname)
plt.clf()
def plot_fixed_arg(self, yval, ylabel="'y-label'", xlabel="loose_arg",
@@ -702,8 +712,13 @@ class Benchmark:
plt.xlabel(eval(xlabel))
plt.ylabel(eval(ylabel))
plt.title(eval(title))
- plt.savefig(os.path.join(sumdir,
- f"{self.name}.{arg}.{arg_value}.{filepostfix}.{file_ext}"))
+ figname = os.path.join(sumdir,
+ f"{self.name}.{arg}.{arg_value}.{filepostfix}.{file_ext}")
+ if figname.endswith(".tex"):
+ import tikzplotlib
+ tikzplotlib.save(figname)
+ else:
+ plt.savefig(figname)
plt.clf()
def export_facts_to_file(self, comment_symbol, f):