8000 Link 3D animation examples to one another. · matplotlib/matplotlib@02b07ef · GitHub
[go: up one dir, main page]

Skip to content

Commit 02b07ef

Browse files
committed
Link 3D animation examples to one another.
Also use double quotes in English text. Also inline definition of Z array; it's not as the docstring of generate() was helpful at all.
1 parent 79b7f25 commit 02b07ef

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

examples/mplot3d/rotate_axes3d_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
A very simple animation of a rotating 3D plot about all 3 axes.
77
8-
See wire3d_animation_demo for another simple example of animating a 3D plot.
8+
See :doc:`wire3d_animation_sgskip` for another example of animating a 3D plot.
99
1010
(This example is skipped when building the documentation gallery because it
1111
intentionally takes a long time to run)

examples/mplot3d/wire3d_animation_sgskip.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Animating a 3D wireframe plot
44
=============================
55
6-
A very simple 'animation' of a 3D plot. See also rotate_axes3d_demo.
6+
A very simple "animation" of a 3D plot. See also :doc:`rotate_axes3d_sgskip`.
77
88
(This example is skipped when building the documentation gallery because it
99
intentionally takes a long time to run)
@@ -14,14 +14,6 @@
1414
import time
1515

1616

17-
def generate(X, Y, phi):
18-
"""
19-
Generates Z data for the points in the X, Y meshgrid and parameter phi.
20-
"""
21-
R = 1 - np.sqrt(X**2 + Y**2)
22-
return np.cos(2 * np.pi * X + phi) * R
23-
24-
2517
fig = plt.figure()
2618
ax = fig.add_subplot(projection='3d')
2719

@@ -40,9 +32,9 @@ def generate(X, Y, phi):
4032
# If a line collection is already remove it before drawing.
4133
if wframe:
4234
wframe.remove()
43-
35+
# Generate data.
36+
Z = np.cos(2 * np.pi * X + phi) * (1 - np.hypot(X, Y))
4437
# Plot the new wireframe and pause briefly before continuing.
45-
Z = generate(X, Y, phi)
4638
wframe = ax.plot_wireframe(X, Y, Z, rstride=2, cstride=2)
4739
plt.pause(.001)
4840

0 commit comments

Comments
 (0)
0