8000 Merge pull request #5914 from dopplershift/fix-barbs · matplotlib/matplotlib@f913aa4 · GitHub
[go: up one dir, main page]

Skip to content

Commit f913aa4

Browse files
committed
Merge pull request #5914 from dopplershift/fix-barbs
Make barbs draw correctly (Fixes #5803)
2 parents 7d1a7c2 + b8f0352 commit f913aa4

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

lib/matplotlib/quiver.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,11 @@ def __init__(self, ax, *args, **kw):
922922
kw['edgecolors'] = barbcolor
923923
kw['facecolors'] = flagcolor
924924

925+
# Explicitly set a line width if we're not given one, otherwise
926+
# polygons are not outlined and we get no barbs
927+
if 'linewidth' not in kw and 'lw' not in kw:
928+
kw['linewidth'] = 1
929+
925930
# Parse out the data arrays from the various configurations supported
926931
x, y, u, v, c = _parse_args(*args)
927932
self.x = x
Loading

lib/matplotlib/tests/test_quiver.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ def test_quiver_key_pivot():
108108
ax.quiverkey(q, 0, 0.5, 1, 'W', labelpos='W')
109109

110110

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+
111122
if __name__ == '__main__':
112123
import nose
113124
nose.runmodule()

0 commit comments

Comments
 (0)
0