FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/2.2.0/gallery/api/legend.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
/
2.2.0
/
gallery
/
api
/
legend.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (21 loc) · 651 Bytes
Breadcrumbs
matplotlib.github.com
/
2.2.0
/
gallery
/
api
/
legend.py
Copy path
File metadata and controls
29 lines (21 loc) · 651 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
"""
===============================
Legend using pre-defined labels
===============================
Defining legend labels with plots.
"""
import
numpy
as
np
import
matplotlib
.
pyplot
as
plt
# Make some fake data.
a
=
b
=
np
.
arange
(
0
,
3
,
.02
)
c
=
np
.
exp
(
a
)
d
=
c
[::
-
1
]
# Create plots with pre-defined labels.
fig
,
ax
=
plt
.
subplots
()
ax
.
plot
(
a
,
c
,
'k--'
,
label
=
'Model length'
)
ax
.
plot
(
a
,
d
,
'k:'
,
label
=
'Data length'
)
ax
.
plot
(
a
,
c
+
d
,
'k'
,
label
=
'Total message length'
)
legend
=
ax
.
legend
(
loc
=
'upper center'
,
shadow
=
True
,
fontsize
=
'x-large'
)
# Put a nicer background color on the legend.
legend
.
get_frame
().
set_facecolor
(
'#00FFCC'
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL