python matplotlib oybn的小论文绘图代码

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python matplotlib oybn的小论文绘图代码相关的知识,希望对你有一定的参考价值。

import matplotlib.pyplot as plt
import pandas as pd

lfr = pd.read_table('/home/sue/Result/hyperplane_LFR.txt',sep = '\t',header=None,names=['accuracy','time','tn','fn','fp','tp'])
ddm = pd.read_table('/home/sue/Result/hyperplane_DDM.txt',sep = '\t',header=None,names=['accuracy','time','tn','fn','fp','tp'])
eddm = pd.read_table('/home/sue/Result/hyperplane_EDDM.txt',sep = '\t',header=None,names=['accuracy','time','tn','fn','fp','tp'])
anb = pd.read_table('/home/sue/Result/hyperplane_ANB.txt',sep = '\t',header=None,names=['accuracy','time','tn','fn','fp','tp'])

with plt.style.context('seaborn-paper'):
    plt.figure(figsize=(8,5))


    #黑色
#    plt.plot(lfr.time,lfr.accuracy,':',color='#000000',label='LFR')
    #深蓝
    plt.plot(ddm.time,ddm.accuracy,'-.',color='#00008B',label='DDM',linewidth=1) 
    #灰色
    plt.plot(eddm.time,eddm.accuracy,'--',color='#808080',label='EDDM',linewidth=1)
    
    plt.plot(anb.time,anb.accuracy,':',color='#000000',label='DINB',linewidth=1)
    axs = plt.gca()
    if type(axs)!=type([]):
        axs=[axs]
    
    for ax in axs:
        ax.yaxis.set_ticks_position('left')
        ax.xaxis.set_ticks_position('bottom')
        ax.spines['bottom'].set_position(('data',0))
        ax.spines['left'].set_position(('data',0))
#    ax.spines['left'].set_color('#000000') 
    
#    ax.spines['bottom'].set_color('#000000') 
    plt.ylim(0,100)
    plt.xlabel('num of examples')
    plt.ylabel('accuracy(%)')
    plt.legend()
    plt.minorticks_on()
#    plt.axis('equal')
    plt.savefig('hyp-acc',dpi=800)

以上是关于python matplotlib oybn的小论文绘图代码的主要内容,如果未能解决你的问题,请参考以下文章

图片和web性能小论

图片和web性能小论

小论字符编码技术

INSTALLSHIELD 2010 预安装组件和软件--小论

如何使用 python/matplotlib 为 3d 绘图设置“相机位置”?

python matplotlib模块——绘制三维图形三维数据散点图(转)