exB: add plot script with results from a student laptop
This commit is contained in:
parent
7f604f0a77
commit
f3331ab620
27
exercises/exerciseB/plot.py
Normal file
27
exercises/exerciseB/plot.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
import pandas as pd
|
||||
from matplotlib import pyplot
|
||||
|
||||
records = [
|
||||
# (n_procs, time, description)
|
||||
(1, 47.38, 'lc'),
|
||||
(1, 44.36, 'mp'),
|
||||
(2, 40.34, 'mp'),
|
||||
(3, 46.79, 'mp'),
|
||||
(4, 51.68, 'mp'),
|
||||
(4, 51.63, 'mp'),
|
||||
]
|
||||
|
||||
data = pd.DataFrame(records,
|
||||
columns=('n_procs', 'time', 'description'))
|
||||
|
||||
fig, axes = pyplot.subplots()
|
||||
axes.set_xlabel('# threads/processes')
|
||||
axes.set_ylabel('time')
|
||||
sub = data[data.description=='lc']
|
||||
axes.plot(sub.n_procs, sub.time, 'ro')
|
||||
sub = data[data.description=='mp']
|
||||
axes.plot(sub.n_procs, sub.time, 'b--+')
|
||||
|
||||
axes.set_ylim(0, data.time.max() * 1.2)
|
||||
|
||||
pyplot.show()
|
Loading…
Reference in a new issue