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 180a21c

Browse filesBrowse files
committed
Merge pull request #5914 from dopplershift/fix-barbs
Make barbs draw correctly (Fixes #5803) Conflicts: lib/matplotlib/tests/test_quiver.py white space vs new test
1 parent 7cea22c commit 180a21c
Copy full SHA for 180a21c

File tree

Expand file treeCollapse file tree

3 files changed

+33
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+33
-0
lines changed

‎lib/matplotlib/quiver.py

Copy file name to clipboardExpand all lines: lib/matplotlib/quiver.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,11 @@ def __init__(self, ax, *args, **kw):
918918
kw['edgecolors'] = barbcolor
919919
kw['facecolors'] = flagcolor
920920

921+
# Explicitly set a line width if we're not given one, otherwise
922+
# polygons are not outlined and we get no barbs
923+
if 'linewidth' not in kw and 'lw' not in kw:
924+
kw['linewidth'] = 1
925+
921926
# Parse out the data arrays from the various configurations supported
922927
x, y, u, v, c = _parse_args(*args)
923928
self.x = x
Loading

‎lib/matplotlib/tests/test_quiver.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_quiver.py
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,34 @@ def test_quiver_copy():
9292
assert q0.V[0] == 2.0
9393

9494

95+
@image_comparison(baseline_images=['quiver_key_pivot'],
96+
extensions=['png'], remove_text=True)
97+
def test_quiver_key_pivot():
98+
fig, ax = plt.subplots()
99+
100+
u, v = np.mgrid[0:2*np.pi:10j, 0:2*np.pi:10j]
101+
102+
q = ax.quiver(np.sin(u), np.cos(v))
103+
ax.set_xlim(-2, 11)
104+
ax.set_ylim(-2, 11)
105+
ax.quiverkey(q, 0.5, 1, 1, 'N', labelpos='N')
106+
ax.quiverkey(q, 1, 0.5, 1, 'E', labelpos='E')
107+
ax.quiverkey(q, 0.5, 0, 1, 'S', labelpos='S')
108+
ax.quiverkey(q, 0, 0.5, 1, 'W', labelpos='W')
109+
110+
111+
@image_comparison(baseline_images=['barbs_test_image'],
112+
extensions=['png'], remove_text=True)
113+
def test_barbs():
114+
x = np.linspace(-5, 5, 5)
115+
X, Y = np.meshgrid(x, x)
116+
U, V = 12*X, 12*Y
117+
fig, ax = plt.subplots()
118+
ax.barbs(X, Y, U, V, np.sqrt(U*U + V*V), fill_empty=True, rounding=False,
119+
sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3),
120+
cmap='viridis')
121+
122+
95123
if __name__ == '__main__':
96124
import nose
97125
nose.runmodule()

0 commit comments

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