Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fdffaf6

Browse filesBrowse files
committed
Simplify remaining quiver examples
1 parent 96b8e00 commit fdffaf6
Copy full SHA for fdffaf6

File tree

Expand file treeCollapse file tree

1 file changed

+12
-21
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-21
lines changed

‎examples/pylab_examples/quiver_demo.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/quiver_demo.py
+12-21Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,26 @@
1515
V = np.sin(Y)
1616

1717
plt.figure()
18-
plt.title('scales with plot width, not view')
18+
plt.title('Arrows scale with plot width, not view')
1919
Q = plt.quiver(X, Y, U, V, units='width')
20-
qk = plt.quiverkey(Q, 0.9, 0.95, 2, r'$2 \frac{m}{s}$',
21-
labelpos='E',
22-
coordinates='figure',
23-
fontproperties={'weight': 'bold'})
24-
plt.axis([-1, 7, -1, 7])
20+
qk = plt.quiverkey(Q, 0.9, 0.9, 2, r'$2 \frac{m}{s}$', labelpos='E',
21+
coordinates='figure')
2522

2623
plt.figure()
2724
plt.title("pivot='mid'; every third arrow; units='inches'")
2825
Q = plt.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
29-
pivot='mid', color='r', units='inches')
30-
qk = plt.quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$',
31-
fontproperties={'weight': 'bold'})
32-
plt.plot(X[::3, ::3], Y[::3, ::3], 'k.')
33-
plt.axis([-1, 7, -1, 7])
26+
pivot='mid', units='inches')
27+
qk = plt.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E',
28+
coordinates='figure')
29+
plt.scatter(X[::3, ::3], Y[::3, ::3], color='r', s=5)
3430

3531
plt.figure()
36-
plt.title("scales with x view; pivot='tip'")
32+
plt.title("pivot='tip'; scales with x view")
3733
M = np.hypot(U, V)
38-
Q = plt.quiver(X, Y, U, V, M,
39-
units='x',
40-
pivot='tip',
41-
width=0.022,
34+
Q = plt.quiver(X, Y, U, V, M, units='x', pivot='tip', width=0.022,
4235
scale=1 / 0.15)
43-
qk = plt.quiverkey(Q, 0.9, 1.05, 1, r'$1 \frac{m}{s}$',
44-
labelpos='E',
45-
fontproperties={'weight': 'bold'})
46-
plt.plot(X, Y, 'k.', markersize=2)
47-
plt.axis([-1, 7, -1, 7])
36+
qk = plt.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E',
37+
coordinates='figure')
38+
plt.scatter(X, Y, color='k', s=5)
4839

4940
plt.show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.