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 ae85a8c

Browse filesBrowse files
authored
Merge pull request #16761 from meeseeksmachine/auto-backport-of-pr-16745-on-v3.2.x
Backport PR #16745 on branch v3.2.x (Allow numbers to set uvc for all arrows in quiver.set_UVC, fixes #16743)
2 parents 9da2546 + 7c13fae commit ae85a8c
Copy full SHA for ae85a8c

File tree

Expand file treeCollapse file tree

2 files changed

+13
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-1
lines changed

‎lib/matplotlib/quiver.py

Copy file name to clipboardExpand all lines: lib/matplotlib/quiver.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ def set_UVC(self, U, V, C=None):
600600
if C is not None:
601601
C = ma.masked_invalid(C, copy=True).ravel()
602602
for name, var in zip(('U', 'V', 'C'), (U, V, C)):
603-
if var is not None and var.size != self.N:
603+
if not (var is None or var.size == self.N or var.size == 1):
604604
raise ValueError(f'Argument {name} has a size {var.size}'
605605
f' which does not match {self.N},'
606606
' the number of arrow positions')

‎lib/matplotlib/tests/test_quiver.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_quiver.py
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,15 @@ def test_quiverkey_angles():
252252
# The arrows are only created when the key is drawn
253253
fig.canvas.draw()
254254
assert len(qk.verts) == 1
255+
256+
257+
def test_quiver_setuvc_numbers():
258+
"""Check that it is possible to set all arrow UVC to the same numbers"""
259+
260+
fig, ax = plt.subplots()
261+
262+
X, Y = np.meshgrid(np.arange(2), np.arange(2))
263+
U = V = np.ones_like(X)
264+
265+
q = ax.quiver(X, Y, U, V)
266+
q.set_UVC(0, 1)

0 commit comments

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