<jupyter_start><jupyter_text>Advanced quiver and quiverkey functionsDemonstrates some more advanced options for `~.axes.Axes.quiver`.  For a simpleexample refer to :doc:`/gallery/images_contours_and_fields/quiver_simple_demo`.Note: The plot autoscaling does not take into account the arrows, sothose on the boundaries may reach out of the picture.  This is not an easyproblem to solve in a perfectly general way.  The recommended workaround is tomanually set the Axes limits in such a case.<jupyter_code>import matplotlib.pyplot as plt
import numpy as np

X, Y = np.meshgrid(np.arange(0, 2 * np.pi, .2), np.arange(0, 2 * np.pi, .2))
U = np.cos(X)
V = np.sin(Y)
fig1, ax1 = plt.subplots()
ax1.set_title('Arrows scale with plot width, not view')
Q = ax1.quiver(X, Y, U, V, units='width')
qk = ax1.quiverkey(Q, 0.9, 0.9, 2, r'$2 \frac{m}{s}$', labelpos='E',
                   coordinates='figure')
fig2, ax2 = plt.subplots()
ax2.set_title("pivot='mid'; every third arrow; units='inches'")
Q = ax2.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
               pivot='mid', units='inches')
qk = ax2.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E',
                   coordinates='figure')
ax2.scatter(X[::3, ::3], Y[::3, ::3], color='r', s=5)
# sphinx_gallery_thumbnail_number = 3

fig3, ax3 = plt.subplots()
ax3.set_title("pivot='tip'; scales with x view")
M = np.hypot(U, V)
Q = ax3.quiver(X, Y, U, V, M, units='x', pivot='tip', width=0.022,
               scale=1 / 0.15)
qk = ax3.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E',
                   coordinates='figure')
ax3.scatter(X, Y, color='0.5', s=1)

plt.show()<jupyter_output><empty_output><jupyter_text>------------References""""""""""The use of the following functions and methods is shown in this example:<jupyter_code>import matplotlib
matplotlib.axes.Axes.quiver
matplotlib.pyplot.quiver
matplotlib.axes.Axes.quiverkey
matplotlib.pyplot.quiverkey<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17647058823529413, 'fraction_numerical': 0.033468559837728194, 'mean_word_length': 4.192105263157894, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '461839', 'license': 'MIT', 'n_tokens_mistral': 797, 'n_tokens_neox': 760, 'n_words': 197, 'path': 'matplotlib/gallery_jupyter/images_contours_and_fields/quiver_demo.ipynb', 'repo_name': 'kingreatwill/penter', 'size': '1972'}