py折线统计图绘制


# -*- coding: utf-8 -*-
import numpy as np

import tensorflow as tf
from matplotlib.path import Path
from matplotlib.patches import PathPatch
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import matplotlib as mpl
import datetime
import time
from matplotlib.dates import DateFormatter
np.set_printoptions(suppress=True)

mpl.rcParams['font.sans-serif']=['SimHei'] #指定默认字体 SimHei为黑体
mpl.rcParams['axes.unicode_minus']=False #用来正常显示负

xcount = [132495,
     132523,	
     132578	,
     132564	,
     132620	,
     132627,	
     132863,	
     133425,
     133496,
     196303,
     196336]


y = [20181210,
     20181211,
     20181212,
     20181213,
     20181214, 
     20181215,
     20181217,
     20181219,
     20181220,
     20181221,
     20181224]  

#总bug数
z = [362,
     362,	
     364,
     370,
     370,
     382,	
     382,	
     388,
     390,
     394,
     400]

#解决了的bug数
t = [355,
     355,
     356,
     359,
     359,
     369,
     369,
     375,
     376,
     379,
     380]

z      =  [x   for x in z] 
xcount =  [ x / 1000  for x in xcount] 

plt.plot(y,xcount,color='blue',marker='x',linewidth=2 ,label = '有效代码行数 ,单位k(千行)')   #在当前绘图对象绘图(X轴,Y轴,蓝色虚线,线宽度)  
plt.plot(y,z,color='red',linewidth=2, marker='x',label = '累计bug数,单位(个)')   #在当前绘图对象绘图(X轴,Y轴,蓝色虚线,线宽度)  
plt.plot(y,t,color='green',linestyle='-.',marker='x',linewidth=2, label = '累计解决bug数,单位(个)')  
plt.xlabel("日期",color = 'r') #X轴标签  
plt.ylabel("行数或者个数",color = 'r')  #Y轴标签  

plt.grid(True)  
plt.legend() # 显示图例
plt.title("GIS内核与应用14次迭代统计图") #图标题  

plt.show() 
		
		
		

数据不是动态生成,还是手工生成的, 此项任务目标为直接爬取生成数据集, 用此法显示

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章