diff --git a/lib/matplotlib/quiver.py b/lib/matplotlib/quiver.py index aef58c979c6..dd92676aa14 100644 --- a/lib/matplotlib/quiver.py +++ b/lib/matplotlib/quiver.py @@ -922,6 +922,11 @@ def __init__(self, ax, *args, **kw): kw['edgecolors'] = barbcolor kw['facecolors'] = flagcolor + # Explicitly set a line width if we're not given one, otherwise + # polygons are not outlined and we get no barbs + if 'linewidth' not in kw and 'lw' not in kw: + kw['linewidth'] = 1 + # Parse out the data arrays from the various configurations supported x, y, u, v, c = _parse_args(*args) self.x = x diff --git a/lib/matplotlib/tests/baseline_images/test_quiver/barbs_test_image.png b/lib/matplotlib/tests/baseline_images/test_quiver/barbs_test_image.png new file mode 100644 index 00000000000..2df429eacaa Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_quiver/barbs_test_image.png differ diff --git a/lib/matplotlib/tests/test_quiver.py b/lib/matplotlib/tests/test_quiver.py index 21d96aa7d1c..8bcd976861a 100644 --- a/lib/matplotlib/tests/test_quiver.py +++ b/lib/matplotlib/tests/test_quiver.py @@ -108,6 +108,17 @@ def test_quiver_key_pivot(): ax.quiverkey(q, 0, 0.5, 1, 'W', labelpos='W') +@image_comparison(baseline_images=['barbs_test_image'], + extensions=['png'], remove_text=True) +def test_barbs(): + x = np.linspace(-5, 5, 5) + X, Y = np.meshgrid(x, x) + U, V = 12*X, 12*Y + fig, ax = plt.subplots() + ax.barbs(X, Y, U, V, np.sqrt(U*U + V*V), fill_empty=True, rounding=False, + sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3), + cmap='viridis') + if __name__ == '__main__': import nose nose.runmodule()