Plot vector field using Matplotlib

Below is a sample script to plot vector field using the package matplotlib in Python

import numpy as np
import matplotlib.pyplot as plt

x,y = np.meshgrid(np.linspace(-5,5,10),np.linspace(-5,5,10))

u = 1
v = 0
# (u,v) = (1,0) : left to right
# (u,v) = (0,1) : up


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.