39 import matplotlib.pyplot
as plt
41 from matplotlib
import cm
43 def makeVectorField(f, xmin, xmax, ymin, ymax, step):
44 X,Y = meshgrid(arange(xmin,xmax,step),arange(ymin,ymax,step))
45 U,V = zip(*map(
lambda xx: f(*xx), zip(X,Y)))
46 Q = quiver( X, Y, U, V, units=
'width')
47 quiverkey(Q, 0, 0, 4,
'', coordinates=
'figure', labelpos=
'W')
50 ax = fig.gca(aspect=
'equal')
51 x = np.loadtxt(
"vfrrt-nonconservative.path")
52 makeVectorField(
lambda x,y: (y/sqrt(x*x+y*y),-x/sqrt(x*x+y*y)), -6, 6, -6, 6, 0.5)
53 ax.plot(x[:,0], x[:,1])