FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/1.4.2/users/legend_guide-6.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.4.2
/
users
/
legend_guide-6.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (17 loc) · 821 Bytes
Breadcrumbs
matplotlib.github.com
/
1.4.2
/
users
/
legend_guide-6.py
Copy path
File metadata and controls
22 lines (17 loc) · 821 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
from
matplotlib
.
legend_handler
import
HandlerPatch
import
matplotlib
.
pyplot
as
plt
import
matplotlib
.
patches
as
mpatches
class
HandlerEllipse
(
HandlerPatch
):
def
create_artists
(
self
,
legend
,
orig_handle
,
xdescent
,
ydescent
,
width
,
height
,
fontsize
,
trans
):
center
=
0.5
*
width
-
0.5
*
xdescent
,
0.5
*
height
-
0.5
*
ydescent
p
=
mpatches
.
Ellipse
(
xy
=
center
,
width
=
width
+
xdescent
,
height
=
height
+
ydescent
)
self
.
update_prop
(
p
,
orig_handle
,
legend
)
p
.
set_transform
(
trans
)
return
[
p
]
c
=
mpatches
.
Circle
((
0.5
,
0.5
),
0.25
,
facecolor
=
"green"
,
edgecolor
=
"red"
,
linewidth
=
3
)
plt
.
gca
().
add_patch
(
c
)
plt
.
legend
([
c
], [
"An ellipse, not a rectangle"
],
handler_map
=
{
mpatches
.
Circle
:
HandlerEllipse
()})
Back
|
FazBrowse Home
|
New Git URL