Using A Slider To Change Variable And Replot Matplotlib Figure
I'm trying to use a slider to change the limits for color scaling i.e using the set_clim(min,max) function. I want it so that two sliders control the values for the min and max val
Solution 1:
The problem is as the error tells you, axes
objects don't have a set_clim
function. You want to change (which makes the error you report on the one I expect, but)
fig.set_clim(smin.val,smax.val)
to
l.set_clim(smin.val,smax.val)
as you need to call set_clim
on a ScalarMappable
object (doc).
As a side note, np.random.random
takes a size arguement so you can do
z = np.random.random((100, 100))
instead of your nested loops.
Post a Comment for "Using A Slider To Change Variable And Replot Matplotlib Figure"