FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/3.3.3/gallery/mplot3d/trisurf3d.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
/
3.3.3
/
gallery
/
mplot3d
/
trisurf3d.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (24 loc) · 849 Bytes
Breadcrumbs
matplotlib.github.com
/
3.3.3
/
gallery
/
mplot3d
/
trisurf3d.py
Copy path
File metadata and controls
34 lines (24 loc) · 849 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
"""
======================
Triangular 3D surfaces
======================
Plot a 3D surface with a triangular mesh.
"""
import
matplotlib
.
pyplot
as
plt
import
numpy
as
np
n_radii
=
8
n_angles
=
36
# Make radii and angles spaces (radius r=0 omitted to eliminate duplication).
radii
=
np
.
linspace
(
0.125
,
1.0
,
n_radii
)
angles
=
np
.
linspace
(
0
,
2
*
np
.
pi
,
n_angles
,
endpoint
=
False
)[...,
np
.
newaxis
]
# Convert polar (radii, angles) coords to cartesian (x, y) coords.
# (0, 0) is manually added at this stage, so there will be no duplicate
# points in the (x, y) plane.
x
=
np
.
append
(
0
, (
radii
*
np
.
cos
(
angles
)).
flatten
())
y
=
np
.
append
(
0
, (
radii
*
np
.
sin
(
angles
)).
flatten
())
# Compute z to make the pringle surface.
z
=
np
.
sin
(
-
x
*
y
)
fig
=
plt
.
figure
()
ax
=
fig
.
gca
(
projection
=
'3d'
)
ax
.
plot_trisurf
(
x
,
y
,
z
,
linewidth
=
0.2
,
antialiased
=
True
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL