def plot(self, df, database_name, test_name, y_label):
means = df.rolling(70).mean()
ax = means.plot(
title=test_name, alpha=0.8,
xlim=(0, means.index.max() * 1.05),
ylim=(0, means.max().max() * 1.05),
)
ax.set(xlabel='Amount of objects in table', ylabel=y_label)
ax.xaxis.set_major_formatter(
FuncFormatter(lambda v, pos: prefix_unit(v, '', -3)))
if y_label in self.ticks_formatters:
ax.yaxis.set_major_formatter(self.ticks_formatters[y_label])
legend = ax.legend(
loc='upper center', bbox_to_anchor=(0.5, 0.0),
bbox_transform=plt.gcf().transFigure,
fancybox=True, shadow=True, ncol=3)
plt.savefig(
os.path.join(self.results_path,
'%s - %s.svg' % (database_name, test_name)),
bbox_extra_artists=(legend,), bbox_inches='tight',
)
评论列表
文章目录