stats.py 文件源码

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

项目:temci 作者: parttimenerd 项目源码 文件源码
def _store_as_pdf(self, filename: str, fig_width: float, fig_height: float) -> str:
        """
        Stores the current figure in a pdf file.

        :param filename: name of the pdf file
        :param fig_width: width of the figure in cm
        :param fig_height: height of the figure in cm
        :warning: modifies the current figure
        """
        import matplotlib.pyplot as plt
        if not filename.endswith(".pdf"):
            filename += ".pdf"
        self.reset_plt()
        self._latexify(fig_width, fig_height)
        try:
            plt.tight_layout()
        except ValueError:
            pass
        self._format_axes(plt.gca())
        plt.savefig(filename)
        self.reset_plt()
        return os.path.realpath(filename)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号