|
15 | 15 | V = np.sin(Y) |
16 | 16 |
|
17 | 17 | plt.figure() |
18 | | -plt.title('scales with plot width, not view') |
| 18 | +plt.title('Arrows scale with plot width, not view') |
19 | 19 | 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') |
25 | 22 |
|
26 | 23 | plt.figure() |
27 | 24 | plt.title("pivot='mid'; every third arrow; units='inches'") |
28 | 25 | 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) |
34 | 30 |
|
35 | 31 | plt.figure() |
36 | | -plt.title("scales with x view; pivot='tip'") |
| 32 | +plt.title("pivot='tip'; scales with x view") |
37 | 33 | 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, |
42 | 35 | 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) |
48 | 39 |
|
49 | 40 | plt.show() |
0 commit comments