FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/1.5.3/examples/widgets/buttons.py at main · matplotlib/matplotlib.github.com · GitHub
matplotlib
/
matplotlib.github.com
Public
Notifications
You must be signed in to change notification settings
Fork
62
Star
29
Code
Issues
1
Pull requests
2
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib.github.com
/
1.5.3
/
examples
/
widgets
/
buttons.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (31 loc) · 895 Bytes
Breadcrumbs
matplotlib.github.com
/
1.5.3
/
examples
/
widgets
/
buttons.py
Copy path
File metadata and controls
40 lines (31 loc) · 895 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import
numpy
as
np
import
matplotlib
.
pyplot
as
plt
from
matplotlib
.
widgets
import
Button
freqs
=
np
.
arange
(
2
,
20
,
3
)
fig
,
ax
=
plt
.
subplots
()
plt
.
subplots_adjust
(
bottom
=
0.2
)
t
=
np
.
arange
(
0.0
,
1.0
,
0.001
)
s
=
np
.
sin
(
2
*
np
.
pi
*
freqs
[
0
]
*
t
)
l
,
=
plt
.
plot
(
t
,
s
,
lw
=
2
)
class
Index
(
object
):
ind
=
0
def
next
(
self
,
event
):
self
.
ind
+=
1
i
=
self
.
ind
%
len
(
freqs
)
ydata
=
np
.
sin
(
2
*
np
.
pi
*
freqs
[
i
]
*
t
)
l
.
set_ydata
(
ydata
)
plt
.
draw
()
def
prev
(
self
,
event
):
self
.
ind
-=
1
i
=
self
.
ind
%
len
(
freqs
)
ydata
=
np
.
sin
(
2
*
np
.
pi
*
freqs
[
i
]
*
t
)
l
.
set_ydata
(
ydata
)
plt
.
draw
()
callback
=
Index
()
axprev
=
plt
.
axes
([
0.7
,
0.05
,
0.1
,
0.075
])
axnext
=
plt
.
axes
([
0.81
,
0.05
,
0.1
,
0.075
])
bnext
=
Button
(
axnext
,
'Next'
)
bnext
.
on_clicked
(
callback
.
next
)
bprev
=
Button
(
axprev
,
'Previous'
)
bprev
.
on_clicked
(
callback
.
prev
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL