Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0367bbf

Browse files
Adding test case for pivot options
1 parent 72819e9 commit 0367bbf

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

102 KB
Loading
102 KB
Loading

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,35 @@ def test_quiver3d_masked():
203203

204204
ax.quiver(x, y, z, u, v, w, length=0.1)
205205

206+
@image_comparison(baseline_images=['quiver3d_pivot_middle'], remove_text=True,
207+
extensions=['png'])
208+
def test_quiver3d_pivot_middle():
209+
fig = plt.figure()
210+
ax = fig.gca(projection='3d')
211+
212+
x, y, z = np.ogrid[-1:0.8:10j, -1:0.8:10j, -1:0.6:3j]
213+
214+
u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z)
215+
v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z)
216+
w = (np.sqrt(2.0 / 3.0) * np.cos(np.pi * x) * np.cos(np.pi * y) *
217+
np.sin(np.pi * z))
218+
219+
ax.quiver(x, y, z, u, v, w, length=0.1, pivot='middle')
220+
221+
@image_comparison(baseline_images=['quiver3d_pivot_tail'], remove_text=True,
222+
extensions=['png'])
223+
def test_quiver3d_pivot_tail():
224+
fig = plt.figure()
225+
ax = fig.gca(projection='3d')
226+
227+
x, y, z = np.ogrid[-1:0.8:10j, -1:0.8:10j, -1:0.6:3j]
228+
229+
u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z)
230+
v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z)
231+
w = (np.sqrt(2.0 / 3.0) * np.cos(np.pi * x) * np.cos(np.pi * y) *
232+
np.sin(np.pi * z))
233+
234+
ax.quiver(x, y, z, u, v, w, length=0.1, pivot='tail')
206235

207236
if __name__ == '__main__':
208237
import nose

0 commit comments

Comments
 (0)