Skip to content

Commit 010d3f3

Browse files
QuLogicmeeseeksmachine
authored andcommitted
Backport PR #21203: Rework plot types quiver
1 parent 32791eb commit 010d3f3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

plot_types/arrays/quiver.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@
88
import matplotlib.pyplot as plt
99
import numpy as np
1010

11-
plt.style.use('_mpl-gallery')
11+
plt.style.use('_mpl-gallery-nogrid')
1212

1313
# 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
1719

1820
# plot
1921
fig, ax = plt.subplots()
2022

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)
2325

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))
2627

2728
plt.show()

0 commit comments

Comments
 (0)