python绘制折线图(多条)

本文介绍了如何使用Python进行多条折线图的绘制,适合编程新手入门。通过实例展示,帮助读者掌握Python数据可视化的基本技巧。
摘要由CSDN通过智能技术生成

在这里插入图片描述

# encoding=utf-8
    from matplotlib import pyplot
    import matplotlib.pyplot as plt
     
    names = range(8,21)
    names = [str(x) for x in list(names)]
     
    x = range(len(names))
    y_train = [0.840,0.839,0.834,0.832,0.824,0.831,0.823,0

.817,0.814,0.812,0.812,0.807,0.805]
    y_test  = [0.838,0.840,0.840,0.834,0.828,0.814,0.812,0.822,0.818,0.815,0.807,0.801,0.796]
    #plt.plot(x, y, 'ro-')
    #plt.plot(x, y1, 'bo-')
    #pl.xlim(-1, 11)  # 限定横轴的范围
    #pl.ylim(-1, 110)  # 限定纵轴的范围
     
     
    plt.plot(x, y_train, marker='o', mec='r', mfc='w',label='uniprot90_train')
    plt.plot(x, y_test, marker='*', ms=10,label='uniprot90_test')
    plt.legend()  # 让图例生效
    plt.xticks(x, names, rotation=1)
     
    plt.margins(0)
    plt.s
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值