0

I have a slider bar which gives the line of a CSV file to be graphed. The slider bar is functional and will return the correct values. However, I can't get the values to show up on the graph. There are two things graphed a scatter plot (with 4 points) and a interpoated surface. The scatter plot shows up as expected. This is the update code:

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) 

Any advice would be greatly appreciated. Thanks in advance!

4

1 回答 1

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

如果轴对于所有数据都保持不变,也没有理由调整轴的大小

于 2013-07-15T20:00:31.057 回答