Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8f0352

Browse files
committed
Add a test for Barbs.
This is based completely on one of the plots in barbs_demo.py, but it does a pretty good job of exercising Barbs' features.
1 parent ec6910c commit b8f0352

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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)