Basic scatter plot with updated plot.py #5
|
@ -7,17 +7,20 @@ threads, timings = [], []
|
||||||
for file in os.listdir('timings'):
|
for file in os.listdir('timings'):
|
||||||
with open(f'timings/{file}', 'r') as f:
|
with open(f'timings/{file}', 'r') as f:
|
||||||
n, t = f.read().strip().split(',')
|
n, t = f.read().strip().split(',')
|
||||||
threads.append(int(n))
|
if n != 'None':
|
||||||
timings.append(float(t))
|
threads.append(int(n))
|
||||||
|
timings.append(float(t))
|
||||||
threads = np.array(threads)
|
threads = np.array(threads)
|
||||||
timings = np.array(timings)
|
timings = np.array(timings)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print('This is the data I loaded: threads =', threads, ', timings =',timings)
|
print('This is the data I loaded: threads =', threads, ', timings =',timings)
|
||||||
|
|
||||||
fig, axs = plt.subplots()
|
fig, axs = plt.subplots()
|
||||||
|
axs.scatter(threads,timings, marker='X')
|
||||||
# CREATE YOUR PLOT HERE
|
axs.set_title("How Fast is my CPU...really")
|
||||||
# Remember to label your axis
|
axs.set_xlabel("Number of Threads Used")
|
||||||
# Feel free to make it pretty
|
axs.set_ylabel("Run Time")
|
||||||
|
|
||||||
plt.savefig('threads_v_timings.png', dpi=300)
|
plt.savefig('threads_v_timings.png', dpi=300)
|
||||||
|
|
BIN
exercises/exerciseA/threads_v_timings.png
Normal file
BIN
exercises/exerciseA/threads_v_timings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
Loading…
Reference in a new issue