|
8 | 8 | import matplotlib.pyplot as plt
|
9 | 9 | import numpy as np
|
10 | 10 |
|
11 |
| -plt.style.use('_mpl-gallery') |
| 11 | +plt.style.use('_mpl-gallery-nogrid') |
12 | 12 |
|
13 | 13 | # make data
|
14 |
| -phi = np.linspace(0, 2 * np.pi, 8) |
15 |
| -x, y = 4 + 1 * np.cos(phi), 4 + 1 * np.sin(phi) |
16 |
| -u, v = 1.5 * np.cos(phi), 1.5 * np.sin(phi) |
| 14 | +x = np.linspace(-4, 4, 6) |
| 15 | +y = np.linspace(-4, 4, 6) |
| 16 | +X, Y = np.meshgrid(x, y) |
| 17 | +U = X + Y |
| 18 | +V = Y - X |
17 | 19 |
|
18 | 20 | # plot
|
19 | 21 | fig, ax = plt.subplots()
|
20 | 22 |
|
21 |
| -ax.quiver(x, y, u, v, color="C0", angles='xy', |
22 |
| - scale_units='xy', scale=0.5, width=.05) |
| 23 | +ax.quiver(X, Y, U, V, color="C0", angles='xy', |
| 24 | + scale_units='xy', scale=5, width=.015) |
23 | 25 |
|
24 |
| -ax.set(xlim=(0, 8), xticks=np.arange(1, 8), |
25 |
| - ylim=(0, 8), yticks=np.arange(1, 8)) |
| 26 | +ax.set(xlim=(-5, 5), ylim=(-5, 5)) |
26 | 27 |
|
27 | 28 | plt.show()
|
0 commit comments