chart.py 文件源码

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

项目:pygcam 作者: JGCRI 项目源码 文件源码
def _finalizeFigure(fig, ax, outFile=None, yFormat=None, sideLabel=False,
                    labelColor=None, transparent=False, openFile=False, closeFig=True):
    if yFormat:
        func = (lambda x, p: format(int(x), ',')) if yFormat == ',' else (lambda x, p: yFormat % x)
        formatter = FuncFormatter(func)
        ax.get_yaxis().set_major_formatter(formatter)

    if sideLabel:
        labelColor = labelColor or 'lightgrey'
        # add the filename down the right side of the plot
        fig.text(1, 0.5, sideLabel, color=labelColor, weight='ultralight', fontsize=7,
                 va='center', ha='right', rotation=270)

    if outFile:
        fig.savefig(outFile, bbox_inches='tight', transparent=transparent)

    if closeFig:
        plt.close(fig)

    if openFile:
        systemOpenFile(outFile)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号