def figure_style1(pylab): f = pylab.gcf() size = 1.57 * 3 ratio = 1 f.set_size_inches((size, size * ratio)) ieee_spines(pylab) yield pylab y_axis_extra_space(pylab) x_axis_extra_space(pylab)
def generic_iteration_plot(report, f, nid, alg_ids, get_trace, caption=None): traces = [] for alg_id in alg_ids: tr = get_trace(alg_id) tr = np.array(tr) traces.append(tr) max_trace_length = max(len(tr) for tr in traces) with report.plot(nid) as pylab: for alg_id, trace in zip(alg_ids, traces): if len(trace) == 1: # one iteration, write continuous line pylab.plot([0, max_trace_length], [trace, trace], '-', label=alg_id) else: pylab.plot(trace, 'x-', label=alg_id) x_axis_extra_space_right(pylab, fraction=0.5) y_axis_extra_space(pylab) pylab.legend() f.sub(report.last(), caption=caption)