'IPywidgets create vmin/vmax slider doesn't work
I'm new to Python and I'm struggling with creating interactive Images. I programmed a function that plots an Image from a 3D Matrix. I managed to create a slider to go through slices of the 3D data (first dimension of the matrix).
However, when I try to make a slider for vmin and vmax, I get the error:
ValueError: cannot find widget or abbreviation for argument: 'v1'
My code:
def signalPlot(mat, num):
sigPlot, ax = plt.subplots()
sigPlotAx = ax.imshow(mat[num,:,:])
plt.colorbar(sigPlotAx)
plt.show()
return sigPlot, sigPlotAx
def updateSP(num1, v1, v2):
sigPlotAx.set_data(cleanMat[num1,:,:])
sigPlotAx.set_clim(vmin=v1, vmax=v2)
sigPlot, sigPlotAx = signalPlot(3DMat,0)
plt.draw()
interact(updateSP, num1=widgets.IntSlider(min=0, max=np.shape(cleanMat)[0]-1, step=1))
interact(updateSP, v1=widgets.IntSlider(min=0, max=0.5, step=.01))
interact(updateSP, v2=widgets.IntSlider(min=0.5, max=2, step=.01))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
