First off, in rereading my message, it sounded more abrasive than I

intended. I should have asked more questions and complained less; sorry.

Eric Firing wrote:

Is there an easy way to get a correct quiver plot (i.e., correct slopes) now if the aspect ratio is not 1?

Please provide a script that illustrates what you think is the problem. Exactly what is it that you want to do, and don't know how to do with quiver as it is?

One application I'd like to use it for is direction field plots for

first order linear differential equations (i.e., y' = some function of x

and y). Given the function y'(x,y), I plot a quiver where U is a vector

of ones and V is a vector of y'(corresponding x and y coordinates), so

for the arrow based at point (x,y), the arrow has slope corresponding to

the slope of the solution that passes through (x,y).

However, when the aspect ratio is not one, a solution will have a

different slope (because the slope is measured in coordinates

corresponding to the axes) than the slope of the arrow.

Here is a small example, modified from the quiver examples in matplotlib.

from pylab import *

X,Y = meshgrid( arange(0,1,.2),arange(0,1,.2) )

def yprime(x,y):

return 1

U,V = meshgrid([1]*len(X), [1]*len(Y))

figure()

Q = quiver(X,Y,U, V)

# This is a solution to the differential equation y'=1, but it doesn't

# look like it because the slopes do not respect the aspect ratio of

# the plot. What should happen is the arrows should point along the

# line.

plot([0,1],[0,1])

axis([0,1,0,0.5])

title("Slope Field for $dy/dx=1$")

show()

In looking at the basemap examples (specifically quiver_demo.py), it

looks like you specifically rotate the vectors to match up with map

coordinates; is that right? Applying to the situation above, do I need

to rotate my vectors to respect the aspect ratio? What's the easiest

way to get quiver(X,Y,U,V) to behave so that the vectors plotted would,

for each coordinate (x,y) and corresponding (u,v), be parallel to the

vector between (x,y) and (x+u, y+v) (where (x, y) and (u,v) are taken as

coordinates in the axis coordinate system).

Please let me know if I'm not clear in what I'm asking.

Thanks,

Jason

## ···

jason-sage@...2130... wrote:

Note that you have full control over U and V; you can make the arrows point any direction you want, and be any length you want. And you can locate them anywhere you want.

Basemap illustrates how quiver can be used with curvilinear coordinates; the U and V are adjusted to align the arrows with the coordinates.

It is possible that quiver needs more modification to work properly and flexibly with the new transforms implementation; in fact I know of a bug that this introduced, and I will commit a correction shortly. I have not looked into quiver behavior with transforms-based projections. They might indeed call for a design change.

Eric