def plotScalabilityResultsForTest(dfs, test, colName, title, xlabel, savePath,
ax=None, logxscale=False, logyscale=True):
dfs = filter(lambda df: df['test'][0] == test, dfs)
if ax is None:
plt.figure()
ax = plt.gca()
lines = []
labels = []
for df in dfs:
x = df[colName]
y = df[TIME_COL] / 60. # convert to minutes
algo = df[ALGORITHM_COL][0]
p = ALGO_2_LINE_PARAMS[algo]
line, = ax.plot(x, y, label=algo, color=p.color, lw=p.width, ls=p.style)
ax.set_xlim([np.min(x), np.max(x)])
lines.append(line)
labels.append(algo)
# seaborn tsplot version; confidence intervals like invisibly thin
# around the lines, so not much point (although verify this once
# all experiments run TODO)
# df = pd.concat(dfs, ignore_index=True)
# colors = dict([algo, p.color] for algo, p in ALGO_2_LINE_PARAMS.items()])
# sb.tsplot(time=colName, value=TIME_COL, unit=SEED_COL,
# condition=ALGORITHM_COL, data=df, ax=ax)
# lines, labels = ax.get_legend_handles_labels()
if logxscale:
ax.set_xscale('log')
if logyscale:
ax.set_yscale('log')
# x = df[colName]
# ax.set_xlim([np.min(x), np.max(x)])
ax.set_title(title)
ax.set_xlabel(xlabel)
ax.set_ylabel("Runtime (min)")
if savePath:
plt.savefig(savePath)
return lines, labels
评论列表
文章目录