2013-07-15 5 views
0

나는 CSV 파일의 라인이 그래프로 표시되도록하는 슬라이더 바를 가지고 있습니다. 슬라이더 막대가 작동하며 올바른 값을 반환합니다. 그러나 그래프에 표시 할 값을 가져올 수 없습니다. 두 가지가 산점도 (4 점)와 보간 된 표면을 그래프로 나타냅니다. 산점도가 예상대로 나타납니다. 이것은 업데이트 코드입니다 :Matplotlib의 2D 표면 업데이트

def update (val): 
    ax.clear() 
    val=int(val) 
    new=a[val] 
    canvas1.blit(axsigma.bbox) 
    ax.scatter(x, y, marker='o', s=256, lw=.1) 
    xi, yi = np.mgrid[x.min():x.max():500j, y.min():y.max():500j] 
    newi = griddata(x,y,new,xi,yi, interp='nn') 
    CS = plt.contourf(xi,yi,newi,500,cmap='jet', vmax=5, vmin=0) ##This line should plot the new temperatures 
    ax.relim() 
    ax.autoscale_view(True,True,True) 

모든 조언을 크게 주시면 감사하겠습니다. 미리 감사드립니다!

답변

0
def update (val): 
    ax.clear() 
    val=int(val) 
    new=a[val] 
    canvas1.blit(axsigma.bbox) 
    xi, yi = np.mgrid[x.min():x.max():500j, y.min():y.max():500j] 
    newi = griddata(x,y,new,xi,yi, interp='nn') 
    CS = ax.contourf(xi,yi,newi,500,cmap='jet', vmax=M, vmin=m) ##change plt to ax 
    ax.scatter(x, y, marker='x', c='k', s=36) ## move to end so scatter is on top of surface 

그들은 모든 데이터

을위한 동일하게 유지하면 축 크기를 조정 할 이유도 없다