FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/examples/api/bbox_intersect.py at master · staticfloat/matplotlib · GitHub
staticfloat
matplotlib
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
examples
/
api
/
bbox_intersect.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
19 lines (16 loc) · 500 Bytes
Breadcrumbs
matplotlib
/
examples
/
api
/
bbox_intersect.py
Copy path
File metadata and controls
19 lines (16 loc) · 500 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
import
numpy
as
np
import
matplotlib
.
pyplot
as
plt
from
matplotlib
.
transforms
import
Bbox
from
matplotlib
.
path
import
Path
rect
=
plt
.
Rectangle
((
-
1
,
-
1
),
2
,
2
,
facecolor
=
"#aaaaaa"
)
plt
.
gca
().
add_patch
(
rect
)
bbox
=
Bbox
.
from_bounds
(
-
1
,
-
1
,
2
,
2
)
for
i
in
range
(
12
):
vertices
=
(
np
.
random
.
random
((
2
,
2
))
-
0.5
)
*
6.0
path
=
Path
(
vertices
)
if
path
.
intersects_bbox
(
bbox
):
color
=
'r'
else
:
color
=
'b'
plt
.
plot
(
vertices
[:,
0
],
vertices
[:,
1
],
color
=
color
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL