From c054a283155b22618e5fb77245bbbedfa0bb097e Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Fri, 26 Sep 2025 12:42:20 +0300 Subject: [PATCH] Add plotting for threads vs time --- exercises/exerciseA/plot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/exercises/exerciseA/plot.py b/exercises/exerciseA/plot.py index 4130224..7c366b0 100755 --- a/exercises/exerciseA/plot.py +++ b/exercises/exerciseA/plot.py @@ -7,7 +7,10 @@ threads, timings = [], [] for file in os.listdir('timings'): with open(f'timings/{file}', 'r') as f: n, t = f.read().strip().split(',') - threads.append(int(n)) + if n != "None": + threads.append(int(n)) + else: + threads.append(0) timings.append(float(t)) threads = np.array(threads) timings = np.array(timings) @@ -19,5 +22,7 @@ fig, axs = plt.subplots() # CREATE YOUR PLOT HERE # Remember to label your axis # Feel free to make it pretty +axs.scatter(threads, timings) +axs.set(xlabel="Threads", ylabel="Time (s)", xlim=(-1, max(threads)*1.1), ylim=(0, max(timings)*1.1), title="Time vs Threads") plt.savefig('threads_v_timings.png', dpi=300) -- 2.39.5