Revision: 6197
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6197&view=rev
Author:   jdh2358
Date:     2008-10-15 03:04:37 +0000 (Wed, 15 Oct 2008)

Log Message:
-----------
updated slider widget example

Added Paths:
-----------
    trunk/matplotlib/examples/widgets/slider_demo.py

Removed Paths:
-------------
    trunk/matplotlib/examples/widgets/sliders.py

Added: trunk/matplotlib/examples/widgets/slider_demo.py
===================================================================
--- trunk/matplotlib/examples/widgets/slider_demo.py                            
(rev 0)
+++ trunk/matplotlib/examples/widgets/slider_demo.py    2008-10-15 03:04:37 UTC 
(rev 6197)
@@ -0,0 +1,43 @@
+from pylab import *
+from matplotlib.widgets import Slider, Button, RadioButtons
+
+ax = subplot(111)
+subplots_adjust(left=0.25, bottom=0.25)
+t = arange(0.0, 1.0, 0.001)
+a0 = 5
+f0 = 3
+s = a0*sin(2*pi*f0*t)
+l, = plot(t,s, lw=2, color='red')
+axis([0, 1, -10, 10])
+
+axcolor = 'lightgoldenrodyellow'
+axfreq = axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor)
+axamp  = axes([0.25, 0.15, 0.65, 0.03], axisbg=axcolor)
+
+sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0)
+samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0)
+
+def update(val):
+    amp = samp.val
+    freq = sfreq.val
+    l.set_ydata(amp*sin(2*pi*freq*t))
+    draw()
+sfreq.on_changed(update)
+samp.on_changed(update)
+
+resetax = axes([0.8, 0.025, 0.1, 0.04])
+button = Button(resetax, 'Reset', color=axcolor, hovercolor=0.975)
+def reset(event):
+    sfreq.reset()
+    samp.reset()
+button.on_clicked(reset)
+
+rax = axes([0.025, 0.5, 0.15, 0.15], axisbg=axcolor)
+radio = RadioButtons(rax, ('red', 'blue', 'green'), active=0)
+def colorfunc(label):
+    l.set_color(label)
+    draw()
+radio.on_clicked(colorfunc)
+
+show()
+

Deleted: trunk/matplotlib/examples/widgets/sliders.py
===================================================================
--- trunk/matplotlib/examples/widgets/sliders.py        2008-10-15 03:01:07 UTC 
(rev 6196)
+++ trunk/matplotlib/examples/widgets/sliders.py        2008-10-15 03:04:37 UTC 
(rev 6197)
@@ -1,36 +0,0 @@
-from pylab import *
-from matplotlib.widgets import Slider, Button
-
-ax = subplot(111)
-subplots_adjust(bottom=0.25)
-t = arange(0.0, 1.0, 0.001)
-s = sin(2*pi*t)
-l, = plot(t,s, lw=2)
-axis([0, 1, -10, 10])
-
-axcolor = 'lightgoldenrodyellow'
-axfreq = axes([0.125, 0.1, 0.775, 0.03], axisbg=axcolor)
-axamp  = axes([0.125, 0.15, 0.775, 0.03], axisbg=axcolor)
-
-sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=1, facecolor='blue', 
alpha=0.5)
-samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=1, facecolor='red', alpha=0.5)
-
-def update(val):
-    amp = samp.val
-    freq = sfreq.val
-    l.set_ydata(amp*sin(2*pi*freq*t))
-    draw()
-sfreq.on_changed(update)
-samp.on_changed(update)
-
-resetax = axes([0.8, 0.025, 0.1, 0.04])
-button = Button(resetax, 'Reset')
-
-def reset(event):
-    sfreq.reset()
-    samp.reset()
-button.on_clicked(reset)
-
-
-show()
-


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to