diff --git a/exercises/exerciseB/plot.py b/exercises/exerciseB/plot.py new file mode 100644 index 0000000..d552cf7 --- /dev/null +++ b/exercises/exerciseB/plot.py @@ -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()