最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python 讀取目錄下csv文件并繪制曲線v111的方法

 更新時間:2018年07月06日 08:41:30   作者:liang890319  
今天小編就為大家分享一篇python 讀取目錄下csv文件并繪制曲線v111的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

實例如下:

# -*- coding: utf-8 -*-
"""
Spyder Editor
This temporary script file is located here:
C:\Users\user\.spyder2\.temp.py
"""
"""
Show how to modify the coordinate formatter to report the image "z"
value of the nearest pixel given x and y
V1.1.1 get all filenames in shortout dir choose one to analysis
"""
# coding: utf-8
 
import time
import string
import os 
import math 
import pylab
import csv
 
import numpy as np
from numpy import genfromtxt
import matplotlib
import matplotlib as mpl
from matplotlib.colors import LogNorm
from matplotlib.mlab import bivariate_normal
 
import matplotlib.pyplot as plt
import matplotlib.cm as cm
 
 
import matplotlib.animation as animation
 
  
pause = False
linenum=0
fileList=[]  #待處理文件路徑
for filename in os.listdir(r'D:\shortout'):
 pa='D:\shortout\%s'%filename
 fileList.append(pa)
 
#for files in range(0,len(fileList)):
 
metric = genfromtxt(fileList[0], delimiter=',')
lines=len(metric) 
#print len(metric)
#print len(metric[4])
#print metric[4] 
 
rowdatas=metric[:,0]
for index in range(len(metric[4])-1):
 a=metric[:,index+1]
 rowdatas=np.row_stack((rowdatas,a))
 
#print len(rowdatas)
#print len(rowdatas[4])
#print rowdatas[4] 
# 
 
#plt.figure(figsize=(38,38), dpi=80)
#plt.plot(rowdatas[4] )
#plt.xlabel('time')
#plt.ylabel('value')
#plt.title("USBHID data analysis")
#plt.show()
 
 
##如果是參數(shù)是list,則默認(rèn)每次取list中的一個元素,即metric[0],metric[1],... 
listdata=rowdatas.tolist()
print listdata[4]
#fig = plt.figure() 
#window = fig.add_subplot(111) 
#line, = window.plot(listdata[4] ) 
 
#plt.ion()
#fig, ax = plt.subplots()
#line, = ax.plot(listdata[4],lw=2)
#ax.grid()
 
 
fig = plt.figure() 
ax = fig.add_subplot(111) 
line, = ax.plot(listdata[4],lw=2 ) # I'm still not clear on this stucture...
ax.grid()
 
time_template = 'Data ROW = %d'
time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)
 
#ax = plt.axes(xlim=(0, 700), ylim=(0, 255)) 
#line, = ax.plot([], [], lw=2) 
def onClick(event):
 global pause
 pause ^= True
 print 'user click the mouse!'
 print 'you pressed', event.button, event.xdata, event.ydata
# event.button=1 鼠標(biāo)左鍵按下 2 中鍵按下 3 右鍵按下 
 
 
def getData(): 
 global listdata
 global linenum
 t = 0 
 while t < len(listdata[4]):
  if not pause: 
   linenum=linenum+1
  yield listdata[linenum-1]
# while t < len(listdata[4]): 
#  t = t + 1 
#  print t,t
#  yield t, t 
  
def update(data): 
 global linenum
 line.set_ydata(data) 
 time_text.set_text(time_template % (linenum))
 return line, 
 
def init():
# ax.set_ylim(0, 1.1)
# ax.set_xlim(0, 10)
# line.set_data(xdata)
 plt.xlabel('time')
 plt.ylabel('Time')
 plt.title('USBHID Data analysis')
 return line,
fig.canvas.mpl_connect('button_press_event', onClick) 
ani = animation.FuncAnimation(fig, update , getData , blit=False, interval=1*1000,init_func=init,repeat=False) 
plt.show() 
 
 
#my_data = genfromtxt('D:\export.csv', delimiter=',')
#rgbdata=my_data、255
#plt.figure(figsize=(38,38), dpi=80)
#
#for index in range(3):
# row9=rgbdata[:,index]
# print "row %d size is\n"%(index)
# plt.plot(row9 )
# plt.xlabel('time')
# plt.ylabel('value')
# plt.title("USBHID data analysis")
# plt.legend()
## plt.cla()
## plt.clf()
#plt.show()
#plt.figure(1)
#plt.imshow(rgbdata, interpolation='nearest')
#plt.grid(True)
 
#fig = plt.figure() # 新圖 0
#plt.savefig() # 保存
#plt.close('all') # 關(guān)閉圖 0
 

以上這篇python 讀取目錄下csv文件并繪制曲線v111的方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Python繪圖并標(biāo)記出指定點(最大值點)方法實例

    Python繪圖并標(biāo)記出指定點(最大值點)方法實例

    我們在用python畫散點圖的時候經(jīng)常會需要標(biāo)記出特定的點,這篇文章主要給大家介紹了關(guān)于Python繪圖并標(biāo)記出指定點(最大值點)的相關(guān)資料,文中通過實例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2023-05-05
  • python通過ftplib登錄到ftp服務(wù)器的方法

    python通過ftplib登錄到ftp服務(wù)器的方法

    這篇文章主要介紹了python通過ftplib登錄到ftp服務(wù)器的方法,涉及Python使用ftplib模塊的相關(guān)技巧,需要的朋友可以參考下
    2015-05-05
  • python mysqldb連接數(shù)據(jù)庫

    python mysqldb連接數(shù)據(jù)庫

    今天無事想弄下python做個gui開發(fā),最近發(fā)布的是python 3k,用到了數(shù)據(jù)庫,通過搜索發(fā)現(xiàn)有一個mysqldb這樣的控件,可以使用,就去官方看了下結(jié)果,沒有2.6以上的版本
    2009-03-03
  • Python使用cx_Oracle調(diào)用Oracle存儲過程的方法示例

    Python使用cx_Oracle調(diào)用Oracle存儲過程的方法示例

    這篇文章主要介紹了Python使用cx_Oracle調(diào)用Oracle存儲過程的方法,結(jié)合具體實例分析了Python中通過cx_Oracle調(diào)用PL/SQL的具體步驟與相關(guān)操作技巧,需要的朋友可以參考下
    2017-10-10
  • Python使用Flask框架獲取當(dāng)前查詢參數(shù)的方法

    Python使用Flask框架獲取當(dāng)前查詢參數(shù)的方法

    這篇文章主要介紹了Python使用Flask框架獲取當(dāng)前查詢參數(shù)的方法,實例分析了query_string獲取查詢參數(shù)的技巧,需要的朋友可以參考下
    2015-03-03
  • Python操作Elasticsearch處理timeout超時

    Python操作Elasticsearch處理timeout超時

    這篇文章主要介紹了Python操作Elasticsearch處理timeout超時,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-07-07
  • node命令行服務(wù)器(http-server)和跨域的實現(xiàn)

    node命令行服務(wù)器(http-server)和跨域的實現(xiàn)

    本文主要介紹了node命令行服務(wù)器(http-server)和跨域的實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-02-02
  • python2使用bs4爬取騰訊社招過程解析

    python2使用bs4爬取騰訊社招過程解析

    這篇文章主要介紹了python2使用bs4爬取騰訊社招過程解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2019-08-08
  • DJango的創(chuàng)建和使用詳解(默認(rèn)數(shù)據(jù)庫sqlite3)

    DJango的創(chuàng)建和使用詳解(默認(rèn)數(shù)據(jù)庫sqlite3)

    今天小編就為大家分享一篇DJango的創(chuàng)建和使用詳解(默認(rèn)數(shù)據(jù)庫sqlite3),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-11-11
  • 詳解Python函數(shù)作用域的LEGB順序

    詳解Python函數(shù)作用域的LEGB順序

    這篇文章主要為大家詳細(xì)介紹了Python函數(shù)作用域的LEGB順序的相關(guān)資料,感興趣的朋友可以參考一下
    2016-05-05

最新評論

南汇区| 西宁市| 丹寨县| 尉氏县| 乃东县| 土默特右旗| 宿松县| 泗阳县| 长乐市| 浦县| 阿图什市| 武义县| 孝义市| 漳州市| 如东县| 方正县| 合作市| 安西县| 馆陶县| 辰溪县| 盐城市| 八宿县| 新化县| 稷山县| 兴仁县| 怀来县| 遂宁市| 武夷山市| 会宁县| 通渭县| 临沭县| 土默特右旗| 龙江县| 汝城县| 南皮县| 盐亭县| 称多县| 甘南县| 江门市| 稻城县| 朝阳市|