odebook.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:qqmbr 作者: ischurov 项目源码 文件源码
def normvectorfield(xs,ys,fs,**kw):
    """
    plot normalized vector field

    kwargs
    ======

    - length is a desired length of the lines (default: 1)
    - the rest of kwards are passed to plot
    """
    length = kw.pop('length') if 'length' in kw else 1
    x, y = np.meshgrid(xs, ys)
    # calculate vector field
    vx,vy = fs(x,y)
    # plot vecor field
    norm = length /np.sqrt(vx**2+vy**2)
    plt.quiver(x, y, vx * norm, vy * norm, angles='xy',**kw)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号