美文网首页
待完成:mataploit 画图

待完成:mataploit 画图

作者: 九剑至尊 | 来源:发表于2017-06-01 23:08 被阅读0次

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

相关文章

网友评论

      本文标题:待完成:mataploit 画图

      本文链接:https://www.haomeiwen.com/subject/gxryfxtx.html