import os import numpy as np import matplotlib.pyplot as plt # IO: This loads the timings for you 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)) timings.append(float(t)) threads = np.array(threads) timings = np.array(timings) print('This is the data I loaded: threads =', threads, ', timings =',timings) fig, axs = plt.subplots() # CREATE YOUR PLOT HERE # Remember to label your axis # Feel free to make it pretty difference = [] for i in range(len(timings)): diff = (timings[i] - timings[0]) / threads[i] difference.append(diff) print(difference) plt.plot(threads, difference, color='orange') plt.xlabel('Threads') plt.ylabel('Time (s)') plt.title('Relative processing time per thread') plt.savefig('threads_v_timings_2.png', dpi=300)