Basic scatter plot with updated plot.py #5

Open
johnbe wants to merge 1 commit from johnbe/2024-heraklion-parallel-python:exercises into main
2 changed files with 9 additions and 6 deletions
Showing only changes of commit 71670f4a66 - Show all commits

View file

@ -7,17 +7,20 @@ 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))
if n != 'None':
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
axs.scatter(threads,timings, marker='X')
axs.set_title("How Fast is my CPU...really")
axs.set_xlabel("Number of Threads Used")
axs.set_ylabel("Run Time")
plt.savefig('threads_v_timings.png', dpi=300)

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB