base.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:django-tree 作者: BertrandBordage 项目源码 文件源码
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',
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号