Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MatplotLib Sliders
#2
I think this question fits more in the GUI forum.

D

Just to answer this anyway, here is what you wanted:
import matplotlib.pyplot as plt
from pylab import *
from matplotlib.widgets import Slider
import numpy as np

c = 0 
a = np.random.random((64, 64))
 
plt.figure('My First GUI')
plt.imshow(a, cmap='gray', interpolation='nearest')

axcolor = 'lightgoldenrodyellow'
axhte = axes([0.15, 0.04, 0.6, 0.03], facecolor=axcolor) #x,y,w,h
axhre = axes([0.15, 0.01, 0.65, 0.03], facecolor=axcolor)

sl1 = Slider(axhte, 'Slider1', -90, 90, valinit=1)
sl2 = Slider(axhre, 'Slider2', -90, 90, valinit=1)

def get_valS1(val):
    print("value of s1:",sl1.val)

def get_valS2(val):
    print("value of s2:",sl2.val)

sl1.on_changed(get_valS1)
sl2.on_changed(get_valS2)

plt.show()
Have a look here to see where I got it from: https://stackoverflow.com/questions/1106...tlib-chart

D
Reply


Messages In This Thread
MatplotLib Sliders - by punksnotdead - May-16-2019, 04:13 PM
RE: MatplotLib Sliders - by DreamingInsanity - May-16-2019, 04:52 PM
RE: MatplotLib Sliders - by punksnotdead - May-17-2019, 09:02 AM
RE: MatplotLib Sliders - by DreamingInsanity - May-17-2019, 05:07 PM
RE: MatplotLib Sliders - by punksnotdead - May-18-2019, 08:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,224 Mar-11-2021, 10:52 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020