zoukankan      html  css  js  c++  java
  • python画图(1): 散点图

    1、代码:

    #coding:utf-8
    #画图1,x轴:FPS,y轴:mean IOU
    #pylab.plot画点时的形状颜色配合:
    #符号:^ , v , < , > , s , + , x , D , d , 1 , 2 , 3 , 4 , h , H , p , | , _ , - , –, -., , . , , , o
    #颜色:b, g, r, c, m, y, k, w
    
    
    import os
    import matplotlib.pyplot as plt
    from pylab import plot
    import pylab as pl
      
    def main():
        method_dict = {'A':[67.84, 46, 'b', '^', 3, 3], 'B':[81.16, 21, 'g', 'v', 3, 3],
                       'C':[85.70, 102, 'y', 'o', 3, 3], 'D':[90.33, 86, 'r', 's', 3, 'bold']}
        fig, ax = plt.subplots()
        for i in method_dict:
            ax.scatter(method_dict[i][1], method_dict[i][0], c=method_dict[i][2], marker=method_dict[i][3], linewidths=method_dict[i][4])
            ax.annotate(i, (method_dict[i][1], method_dict[i][0]), weight=method_dict[i][5])
        plt.xlabel('FPS')
        plt.ylabel('mean IOU(%)')
        plt.xticks([0, 30, 60, 90, 120])
        plt.yticks([0, 20, 40, 60, 80, 100])
        plt.grid(True)
        plt.show()
        fig.savefig('plot.jpg')
    
    if __name__ == "__main__":
        main()

     2、效果:

     3、scatter函数原型:

     

  • 相关阅读:
    一、用Delphi10.3模拟读取百度网页,并读取相关头部信息
    计算机语言发展史
    VMware workstation 14 安装 iOS虚拟机
    mysql-1
    linux网页资料链接
    Ubuntu常用命令大全
    搭建yum源
    CentOS7安装iptables防火墙
    nginx 第二课
    交换机
  • 原文地址:https://www.cnblogs.com/zf-blog/p/12191783.html
Copyright © 2011-2022 走看看