.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_plot_quiver.py: Vector field quiver plot ========================= Demonstration of vector field quiver plot. .. image:: /examples/images/sphx_glr_plot_quiver_001.png :class: sphx-glr-single-img .. code-block:: default import numpy as np import matplotlib.pyplot as plt import pyimof # --- Load the MiniCooper sequence I0, I1 = pyimof.data.minicooper() # --- Estimate the optical flow u, v = pyimof.solvers.ilk(I0, I1) norm = np.sqrt(u*u + v*v) # --- Display it with different options fig = plt.figure(figsize=((9, 7))) ax0, ax1, ax2, ax3 = fig.subplots(2, 2, True, True).ravel() fig.tight_layout() ax0.imshow(I0, cmap='gray') ax0.set_axis_off() ax0.set_title("Reference image") pyimof.display.quiver(u, v, ax=ax1) ax1.set_title("Raw arrows") pyimof.display.quiver(u, v, c=norm, bg=I0, ax=ax2, cmap='jet', bg_cmap='gray') ax2.set_title("Arrows colored according to their norm over Image") pyimof.display.quiver(u, v, bg=norm, ax=ax3, color='r') ax3.set_title("Red arrows over magnitude") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.070 seconds) .. _sphx_glr_download_examples_plot_quiver.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_quiver.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_quiver.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_