Using matplotlib slider widget to change clim in image

后端 未结 2 974
我在风中等你
我在风中等你 2021-02-06 07:24

I have virtually no experience with python, but I am trying to create a simple script which loads an image and uses the slider widget to adjust the minimum and maximum of the co

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-06 08:14

    According to the documentation, imshow returns a `matplotlib.image.AxesImage' object. When you put in that comma, Python assumes that the return type of the function is going to be something iterable (usually a tuple when you would be using this construction, but not necessarily) because Python lets you write code like this:

    a = my_function() # a = (c, d)
    a, b = my_function() # a = c, b = d
    

    but

    a, = my_function() # you should get an error
    

    I'm not entirely sure what Python is putting in im1 without checking (but from your question I get the impression that writing im1,=... works while im1=... doesn't), but I suspect you are failing to draw the image for some reason. Does update actually get called? If it does, maybe try im1.draw() instead.

提交回复
热议问题