# -*- coding: utf-8 -*- """ Created on Tue Nov 04 21:22:29 2014 @author: dell """ import numpy as np import matplotlib.pyplot as plt x, y = np.meshgrid(np.linspace(-2,2,21), np.linspace(-2,2,21)) z = x * np.exp(-x**2 - y**2) u, v = np.gradient(z, .2, .2) fig, ax = plt.subplots() ax.quiver(x, y, u, v) plt.show()