From 02b07ef4ba2f8fb89203a23905af219003916843 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Fri, 8 Jul 2022 12:35:12 +0200 Subject: [PATCH] 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. --- examples/mplot3d/rotate_axes3d_sgskip.py | 2 +- examples/mplot3d/wire3d_animation_sgskip.py | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/examples/mplot3d/rotate_axes3d_sgskip.py b/examples/mplot3d/rotate_axes3d_sgskip.py index 6026c63621c0..8d27873c3b74 100644 --- a/examples/mplot3d/rotate_axes3d_sgskip.py +++ b/examples/mplot3d/rotate_axes3d_sgskip.py @@ -5,7 +5,7 @@ A very simple animation of a rotating 3D plot about all 3 axes. -See wire3d_animation_demo for another simple example of animating a 3D plot. +See :doc:`wire3d_animation_sgskip` for another example of animating a 3D plot. (This example is skipped when building the documentation gallery because it intentionally takes a long time to run) diff --git a/examples/mplot3d/wire3d_animation_sgskip.py b/examples/mplot3d/wire3d_animation_sgskip.py index aa7d0395cf5d..b4f681e778f5 100644 --- a/examples/mplot3d/wire3d_animation_sgskip.py +++ b/examples/mplot3d/wire3d_animation_sgskip.py @@ -3,7 +3,7 @@ Animating a 3D wireframe plot ============================= -A very simple 'animation' of a 3D plot. See also rotate_axes3d_demo. +A very simple "animation" of a 3D plot. See also :doc:`rotate_axes3d_sgskip`. (This example is skipped when building the documentation gallery because it intentionally takes a long time to run) @@ -14,14 +14,6 @@ import time -def generate(X, Y, phi): - """ - Generates Z data for the points in the X, Y meshgrid and parameter phi. - """ - R = 1 - np.sqrt(X**2 + Y**2) - return np.cos(2 * np.pi * X + phi) * R - - fig = plt.figure() ax = fig.add_subplot(projection='3d') @@ -40,9 +32,9 @@ def generate(X, Y, phi): # If a line collection is already remove it before drawing. if wframe: wframe.remove() - + # Generate data. + Z = np.cos(2 * np.pi * X + phi) * (1 - np.hypot(X, Y)) # Plot the new wireframe and pause briefly before continuing. - Z = generate(X, Y, phi) wframe = ax.plot_wireframe(X, Y, Z, rstride=2, cstride=2) plt.pause(.001)