FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/examples/mplot3d/offset.py at master · phobson/matplotlib · GitHub
phobson
/
matplotlib
Public
forked from
matplotlib/matplotlib
Notifications
You must be signed in to change notification settings
Fork
1
Star
1
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
/
examples
/
mplot3d
/
offset.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (24 loc) · 828 Bytes
Breadcrumbs
matplotlib
/
examples
/
mplot3d
/
offset.py
Copy path
File metadata and controls
33 lines (24 loc) · 828 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
'''
=========================
Automatic Text Offsetting
=========================
This example demonstrates mplot3d's offset text display.
As one rotates the 3D figure, the offsets should remain oriented the
same way as the axis label, and should also be located "away"
from the center of the plot.
This demo triggers the display of the offset text for the x and
y axis by adding 1e5 to X and Y. Anything less would not
automatically trigger it.
'''
import
matplotlib
.
pyplot
as
plt
import
numpy
as
np
fig
=
plt
.
figure
()
ax
=
fig
.
gca
(
projection
=
'3d'
)
X
,
Y
=
np
.
mgrid
[
0
:
6
*
np
.
pi
:
0.25
,
0
:
4
*
np
.
pi
:
0.25
]
Z
=
np
.
sqrt
(
np
.
abs
(
np
.
cos
(
X
)
+
np
.
cos
(
Y
)))
ax
.
plot_surface
(
X
+
1e5
,
Y
+
1e5
,
Z
,
cmap
=
'autumn'
,
cstride
=
2
,
rstride
=
2
)
ax
.
set_xlabel
(
"X label"
)
ax
.
set_ylabel
(
"Y label"
)
ax
.
set_zlabel
(
"Z label"
)
ax
.
set_zlim
(
0
,
2
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL