FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/examples/widgets/check_buttons.py at master · coid/matplotlib.github.com · GitHub
coid
/
matplotlib.github.com
Public
forked from
matplotlib/matplotlib.github.com
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib.github.com
/
examples
/
widgets
/
check_buttons.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (21 loc) · 715 Bytes
Breadcrumbs
matplotlib.github.com
/
examples
/
widgets
/
check_buttons.py
Copy path
File metadata and controls
26 lines (21 loc) · 715 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
import
numpy
as
np
import
matplotlib
.
pyplot
as
plt
from
matplotlib
.
widgets
import
CheckButtons
t
=
np
.
arange
(
0.0
,
2.0
,
0.01
)
s0
=
np
.
sin
(
2
*
np
.
pi
*
t
)
s1
=
np
.
sin
(
4
*
np
.
pi
*
t
)
s2
=
np
.
sin
(
6
*
np
.
pi
*
t
)
fig
,
ax
=
plt
.
subplots
()
l0
,
=
ax
.
plot
(
t
,
s0
,
visible
=
False
,
lw
=
2
)
l1
,
=
ax
.
plot
(
t
,
s1
,
lw
=
2
)
l2
,
=
ax
.
plot
(
t
,
s2
,
lw
=
2
)
plt
.
subplots_adjust
(
left
=
0.2
)
rax
=
plt
.
axes
([
0.05
,
0.4
,
0.1
,
0.15
])
check
=
CheckButtons
(
rax
, (
'2 Hz'
,
'4 Hz'
,
'6 Hz'
), (
False
,
True
,
True
))
def
func
(
label
):
if
label
==
'2 Hz'
:
l0
.
set_visible
(
not
l0
.
get_visible
())
elif
label
==
'4 Hz'
:
l1
.
set_visible
(
not
l1
.
get_visible
())
elif
label
==
'6 Hz'
:
l2
.
set_visible
(
not
l2
.
get_visible
())
plt
.
draw
()
check
.
on_clicked
(
func
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL