python画框框图

#conding=utf-8
"""
@author=wanggang
date:March,9,2020
"""
import numpy as np
import matplotlib.pyplot as plt
list1=[1,2,1,2,0,0,1,0,0]#角度1
list2=[2,1,0,1,2,0,2,0,1]#角度2
list3=[1,2,1,1,2,0,2,0,2]#角度3

from matplotlib.patches import Ellipse, Circle
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches

#filepath2的文件里的内容是拒绝的文章
size=20
fig = plt.figure()
ax = fig.add_subplot(111)
num=0
pp=0#角度1
y3 = 'novel'
for i in range(0,len(list1)):
    print(i)
    num+=30
    pp+=1
    y1=30
    y2=45.90
    y3='novel'
    if int(list1[i])==2:
        ax.plot(30+pp, 30, color='red',marker='s', alpha=1,markersize=size)
        plt.text(30 + pp , 30+2.4 , '%.2f' % y1, ha='center', va='bottom')

    elif int(list1[i])==1:
        ax.plot(30 + pp, 30 , color='green', marker='s', alpha=1,markersize=size)
        plt.text(30 + pp , 30+2.4, '%.2f' % y2, ha='center', va='bottom')
        # continue
    elif int(list1[i])==0:
        ax.plot(30 + pp, 30 , color='yellow', marker='s'

猜你喜欢

转载自blog.csdn.net/zhuiyunzhugang/article/details/104786458