FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/mpl_examples/api/compound_path.py at master · phobson/matplotlib.github.com · GitHub
phobson
/
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
/
mpl_examples
/
api
/
compound_path.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (27 loc) · 868 Bytes
Breadcrumbs
matplotlib.github.com
/
mpl_examples
/
api
/
compound_path.py
Copy path
File metadata and controls
38 lines (27 loc) · 868 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
"""
=============
Compound path
=============
Make a compound path -- in this case two simple polygons, a rectangle
and a triangle. Use CLOSEPOLY and MOVETO for the different parts of
the compound path
"""
import
numpy
as
np
from
matplotlib
.
path
import
Path
from
matplotlib
.
patches
import
PathPatch
import
matplotlib
.
pyplot
as
plt
vertices
=
[]
codes
=
[]
codes
=
[
Path
.
MOVETO
]
+
[
Path
.
LINETO
]
*
3
+
[
Path
.
CLOSEPOLY
]
vertices
=
[(
1
,
1
), (
1
,
2
), (
2
,
2
), (
2
,
1
), (
0
,
0
)]
codes
+=
[
Path
.
MOVETO
]
+
[
Path
.
LINETO
]
*
2
+
[
Path
.
CLOSEPOLY
]
vertices
+=
[(
4
,
4
), (
5
,
5
), (
5
,
4
), (
0
,
0
)]
vertices
=
np
.
array
(
vertices
,
float
)
path
=
Path
(
vertices
,
codes
)
pathpatch
=
PathPatch
(
path
,
facecolor
=
'None'
,
edgecolor
=
'green'
)
fig
,
ax
=
plt
.
subplots
()
ax
.
add_patch
(
pathpatch
)
ax
.
set_title
(
'A compound path'
)
ax
.
dataLim
.
update_from_data_xy
(
vertices
)
ax
.
autoscale_view
()
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL