quiver

# -*- 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()

posted @ 2014-11-04 21:25  林中细雨  阅读(421)  评论(0编辑  收藏  举报