From 8cc4bba85900a867db2a0b93d807032b29174244 Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Sun, 24 Apr 2016 16:11:44 +0200 Subject: [PATCH] Improve Plotting --- cool.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cool.py b/cool.py index 18ed21d..a4ccd1b 100755 --- a/cool.py +++ b/cool.py @@ -19,7 +19,7 @@ def natural_key(string_): def parse_timedelta(strrep): minutes, seconds = strrep.split(":") - return seconds + 60 * minutes + return float(seconds) + 60 * float(minutes) class SolverExperiment(Experiment): @@ -137,6 +137,7 @@ class ComparisonExperiment(Experiment): command = command.split("<")[1].strip().strip('"') formula = os.path.basename(command) time = parse_timedelta(timeline.split(": ")[1].strip()) + time = time if time > 0 else 0.001 memory = memoryline.split(": ")[1].strip() csv.append([formula, time, memory]) csv.flush() @@ -154,6 +155,7 @@ class ComparisonExperiment(Experiment): os.path.basename(self.inputs.treetab.metadata['formulas'])) plt.yscale('log') plt.ylabel('time / s') + plt.ylim(0.001, 10000) plt.xlabel('problem size') plt.plot([x[0].split('.')[1] for x in self.outputs.cool_data.value], [x[1] for x in self.outputs.cool_data.value], @@ -161,11 +163,11 @@ class ComparisonExperiment(Experiment): plt.plot([x[0].split('.')[1] for x in self.outputs.treetab_data.value], [x[1] for x in self.outputs.treetab_data.value], 'gv', label="TreeTab") - plt.legend() plt.plot([x[0].split('.')[1] for x in self.outputs.gmul_data.value], [x[1] for x in self.outputs.gmul_data.value], 'r*', label="GMUL") + plt.legend(loc=2) plt.savefig('time.svg', format='svg') plt.close() @@ -181,11 +183,11 @@ class ComparisonExperiment(Experiment): plt.plot([x[0].split('.')[1] for x in self.outputs.treetab_data.value], [x[2] for x in self.outputs.treetab_data.value], 'gv', label="TreeTab") - plt.legend() plt.plot([x[0].split('.')[1] for x in self.outputs.gmul_data.value], [x[2] for x in self.outputs.gmul_data.value], 'r*', label="GMUL") + plt.legend(loc=2) plt.savefig('memory.svg', format='svg') -- 2.39.5