待完成:mataploit 畫圖

https://stackoverflow.com/questions/29828477/how-to-change-tkinter-label-text-on-button-press
等一系列問題

  1. 畫多個圖
# -*- coding: utf-8 -*-
"""
根據raw進行畫圖,畫出所有的站點周末日進出站圖形
,供我進行翻閱和參考
所有圖形全部存放在文件夾1下面,存儲在weekend

@author: scding
"""
import numpy as np  
  
import matplotlib  
matplotlib.use('Agg')  
  
#from matplotlib.pyplot import savefig  
from matplotlib import pyplot as plt

#from matplotlib.pyplot import figure
i = 0
array = np.loadtxt('3cluster_label_1_poi.txt')  
######手工去掉第一行的行數
f = open('1.txt', 'r')
fig=plt.figure(figsize=(20,20),dpi=200)
    
for line in open('1.txt'): 
    line = f.readline()
    line = line.strip()
    temp_strlist = line.split(" ")
    strlist=temp_strlist
    i+=1
    weekinlist=[]
    weekoutlist=[]
    weekendinlist=[]
    weekendoutlist=[]
    for index, el in enumerate(strlist):
        if(index<=18):
            weekinlist.append(float(el))
        elif((index>18)&(index<=37)):
            weekoutlist.append(float(el))
        elif((index>37)&(index<=56)):
            weekendinlist.append(float(el))
        else:
            weekendoutlist.append(float(el))
    
    
    if(array[i-1]!=0):
        continue
    
    
    x=np.linspace(5,23,19) 
    #fig=plt.figure(figsize=(20,20),dpi=200)
    font = {'family' : 'serif',  
        #'color'  : 'darkred',  
        'weight' : 'normal',  
        'size'   : 30,  
        } 
    
    axes = plt.subplot(111)
    print weekoutlist
    axes.plot(x,weekinlist,'--*b',linewidth=0.5)    
    axes.plot(x,weekoutlist,'--.r',linewidth=0.5)
    axes.plot(x,weekendinlist,'--+g',linewidth=3.0)    
    axes.plot(x,weekendoutlist,'--,y',linewidth=3.0)
    
axes.set_xticks([])
axes.set_xticks(range(5,24))
axes.set_xticklabels(range(5,24))
    
for label in axes.xaxis.get_ticklabels():
    label.set_family('serif')
    label.set_color('red')
    #label.set_rotation(45)
    label.set_fontsize(20)
    
for label in axes.yaxis.get_ticklabels():
    label.set_family('serif')
    label.set_color('red')
    label.set_rotation(45)
    label.set_fontsize(20)
    
    
plt.xlabel('Time during Weekend',fontdict=font)
plt.ylabel('People Number',fontdict=font)
    
axes.legend(loc='upper right',prop=font)
plt.savefig('E:/sunBelt/10 ppt/ploit/4/'+str(i)+'.jpg')
    
    
plt.clf()
plt.close('all')

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容