matplotlib slider not working when called from a function

后端 未结 2 1979
小鲜肉
小鲜肉 2021-01-22 07:52

I have the following code, which shows a graph with a slinding bar

    from matplotlib.widgets import Slider
    import matplotlib.pyplot as plt
    from numpy i         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-22 08:23

    Based on this you need to keep the sliders around globally.

    Your example would only need to be slightly adjusted:

    def myplot(): 
        (... same code as above)
        return szoom
    
    keep_sliders = myplot()
    

提交回复
热议问题