2016-09-30 10 views
0

pyqtgraph에서 isocurve를 사용하여이 (level curves from matplotlib)을 얻는 방법을 아는 사람이 있습니까? 내 코드는 ...pyqtgraph와 레벨 곡선 : isocurve

고마워요!

from pyqtgraph.Qt import QtGui,QtCore 
import numpy as np 
import pyqtgraph as pg 
import sys 

#data creation 
app=QtGui.QApplication([]) 
x = np.linspace(0,6.28,30) 
y = x[:] 
xx,yy = np.meshgrid(x,y) 
z = np.sin(xx)+np.cos(yy) 

win = pg.GraphicsWindow() 
win.setWindowTitle('esempio isocurve') 
vb = win.addViewBox() 
img = pg.ImageItem(z) 
vb.addItem(img) #visualizes img in viewbox vb 
vb.setAspectLocked() #set img proportions (?) 

c = pg.IsocurveItem(data=z,level=2,pen='r') 
c.setParentItem(img) #set img as parent of the isocurve item c (?) 
c.setZValue(10) #I DO NOT KNOW THE MEANING OF THIS, JUST COPIED FROM THE EXAMPLE isocurve.py 

vb.addItem(c) 

win.show() 
sys.exit(app.exec_()) 

답변

0

내가 오류를 제거하기 위해 ~ 1500 행에서 "functions.py"을 편집했다 [SOLVED]

"TypeError: Cannot cast ufunc add output from dtype('int32') to dtype('uint8') with casting rule 'same_kind'". 

"functions.py는" 에있는 파일 C : \ Users \ my_name \ AppData \ Local \ Programs \ Python \ Python35 \ Lib \ site-packages \ pyqtgraph (Windows 검색 엔진은 숨겨진 폴더 안에 있기 때문에 찾지 못했습니다!) 다음은 수정이 this Google Group 제안 것 : 2였다으로

index += (fields[i,j] * 2**vertIndex) 

내 코드에서

index += (fields[i,j] * 2**vertIndex).astype(np.ubyte). 

이되고, 난,

level=0 

대신

level=2 

을 설정했다 엄마보다 z의 최소값. 다시 말해, 나는 1500m의 산에서 2000m 레벨의 곡선을 그려 내려고했다. 항상 적절한 수준을 제공하는 것을 잊지 마십시오 !!! Here's the correct output (-.- ')