Python Forum
Plotting axes help - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Plotting axes help (/thread-23903.html)

Pages: 1 2


RE: Plotting axes help - jefsummers - Jan-24-2020

You need to respond to changes in sliders. For example
def value_changedX(change):
    xdeg1.value = change.new
    print (f'Slider 1 value is {xdeg1.value}')

def value_changedY(change):
    xdeg2.value = change.new
    print(f'Slider 2 value is {xdeg2.value}')
xdeg1.observe(value_changedX, 'value')
xdeg2.observe(value_changedY, 'value')
The call to observe is how you link the slider change to your code.
The function is where you react to that change. So, you probably want to move all of your calculations and plotting into a function that you then call from value_changed. You could move the code into value_changed but since you will do this for both sliders it would be better to keep it separate.


RE: Plotting axes help - StillAnotherDave - Jan-24-2020

Thanks!! I'll have to do a bit more study to get the hang of it. New material for me.

Your help has been appreciated!!