From: David Raymond <raymond@ke...>  20120829 20:46:46

I think that I have found a serious bug in vector plotting (quiver) when the "angle=xy" option is used on a plot with a large aspect ratio. It is my understanding that with this option, the vector with tail at (x,y) would have its head at (x + vx,y + vy); at least this is what it says in the documentation. The problem is best illustrated by the following example:  #!/usr/bin/python # from numpy import * import matplotlib.pyplot as plt lx = 100. ly = 10. pi = 3.14159 kx = pi/lx ky = pi/ly nx = 21 ny = 21 x = linspace(0,lx,nx) y = linspace(0,ly,ny) (X,Y) = meshgrid(x,y) # this is a streamfunction psi = sin(kx*X)*sin(ky*Y) # these are the velocity components derived from the streamfunction vx = ky*sin(kx*X)*cos(ky*Y) vy = kx*cos(kx*X)*sin(ky*Y) # plot the x velocity cx = plt.contourf(x,y,vx) b = plt.colorbar(cx, orientation='vertical') tl = plt.title("vx") xlab = plt.xlabel("x") ylab = plt.ylabel("y") plt.show() # plot the y velocity cy = plt.contourf(x,y,vy) b = plt.colorbar(cy, orientation='vertical') tl = plt.title("vy") xlab = plt.xlabel("x") ylab = plt.ylabel("y") plt.show() # plot the streamfunction and the velocity vectors using the angles=xy option cp = plt.contour(x,y,psi) q = plt.quiver(X,Y,vx,vy,angles='xy') tl = plt.title("psi contours, (vx,vy) vectors") xlab = plt.xlabel("x") ylab = plt.ylabel("y") plt.show()  The contour plot of vy, the y component of the vector, clearly shows that vy is nonzero at y = 5. However, the vector plot has it zero along this line. Interestingly, vx appears to be represented correctly on the x = 50 line. The magnitude of vectors should be inversely proportional to the spacing of streamfunction contours, and this is manifestly untrue in the vector plot. Please tell me if I am doing something stupid. Dave PS: I am using matplotlib 1.1.1 and numpy 1.6.2 on Arch linux. (Yes, I have to set the #!/bin/python line in the example to #!/bin/python2 on Arch, since Arch has python3 as default!)  David J. Raymond Prof. of Physics New Mexico Tech http://www.physics.nmt.edu/~raymond/index.html 