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() 
		
		
		

數據不是動態生成,還是手工生成的, 此項任務目標爲直接爬取生成數據集, 用此法顯示

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