.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "plot_types/arrays/barbs.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. meta:: :keywords: codex .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_plot_types_arrays_barbs.py: ================= barbs(X, Y, U, V) ================= See `~matplotlib.axes.Axes.barbs`. .. GENERATED FROM PYTHON SOURCE LINES 8-34 .. image-sg:: /plot_types/arrays/images/sphx_glr_barbs_001.png :alt: barbs :srcset: /plot_types/arrays/images/sphx_glr_barbs_001.png, /plot_types/arrays/images/sphx_glr_barbs_001_2_00x.png 2.00x :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data: X, Y = np.meshgrid([1, 2, 3, 4], [1, 2, 3, 4]) angle = np.pi / 180 * np.array([[15., 30, 35, 45], [25., 40, 55, 60], [35., 50, 65, 75], [45., 60, 75, 90]]) amplitude = np.array([[5, 10, 25, 50], [10, 15, 30, 60], [15, 26, 50, 70], [20, 45, 80, 100]]) U = amplitude * np.sin(angle) V = amplitude * np.cos(angle) # plot: fig, ax = plt.subplots() ax.barbs(X, Y, U, V, barbcolor='C0', flagcolor='C0', length=7, linewidth=1.5) ax.set(xlim=(0, 4.5), ylim=(0, 4.5)) plt.show() .. _sphx_glr_download_plot_types_arrays_barbs.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: barbs.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: barbs.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_