data_visualization.py 文件源码

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

项目:Oedipus 作者: tum-i22 项目源码 文件源码
def plotAccuracyGraph(X, Y, Xlabel='Variable', Ylabel='Accuracy', graphTitle="Test Accuracy Graph", filename="graph.pdf"):
    """ Plots and saves accuracy graphs """
    try:
        timestamp = int(time.time())
        fig = P.figure(figsize=(8,5))
        # Set the graph's title
        P.title(graphTitle, fontname='monospace')
        # Set the axes labels
        P.xlabel(Xlabel, fontsize=12, fontname='monospace')
        P.ylabel(Ylabel, fontsize=12, fontname='monospace')
        # Add horizontal and vertical lines to the graph
        P.grid(color='DarkGray', linestyle='--', linewidth=0.1, axis='both')
        # Add the data to the graph
        P.plot(X, Y, 'r-*', linewidth=1.0)
        # Save figure
        prettyPrint("Saving figure to ./%s" % filename)#(graphTitle.replace(" ","_"), timestamp))
        P.tight_layout()
        fig.savefig("./%s" % filename)#(graphTitle.replace(" ", "_"), timestamp))

    except Exception as e:
        prettyPrint("Error encountered in \"plotAccuracyGraph\": %s" % e, "error")
        return False

    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号