首页 > 编程语言 > 详细

python画图(1): 散点图

时间:2020-01-14 15:55:54      阅读:109      评论:0      收藏:0      [点我收藏+]

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函数原型:

技术分享图片

技术分享图片

 

 技术分享图片

python画图(1): 散点图

原文:https://www.cnblogs.com/zf-blog/p/12191783.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!