quiver question

I have a collection of 2d points xy.
Instead of simply plotting the points,
I'd like to plot a collection of arrows
that goes from each point to the next.
The "from" is easy of course;
the "to" is the problem.

I think I should be able to use quiver,
but I'm not getting it quite right.
E.g.,

x,y = zip(*xy)
u,v = np.diff(x), np.diff(y)
quiver(x[:-1], y[:-1], u, v, angles='xy')

looks like a start but does not get there.
I guessed that `scale=1` would complete
the picture, but that just showed that I
misunderstood `scale`.

Suggestions?

Alan Isaac

Alan G Isaac wrote:

I have a collection of 2d points xy.
Instead of simply plotting the points,
I'd like to plot a collection of arrows
that goes from each point to the next.
The "from" is easy of course;
the "to" is the problem.

I think I should be able to use quiver,
but I'm not getting it quite right.
E.g.,

x,y = zip(*xy)
u,v = np.diff(x), np.diff(y)
quiver(x[:-1], y[:-1], u, v, angles='xy')

looks like a start but does not get there.
I guessed that `scale=1` would complete
the picture, but that just showed that I
misunderstood `scale`.

Suggestions?

Try this:

quiver(x[:-1], y[:-1], u, v, angles='xy', units='x', scale=1)

Eric

That works perfectly when there is change only in x,
but not when both coordinates change. It seems like
I want a `units='xy'` option, to get the right
scaling along each axis, but it does not exist.

However I can "fake it" pretty well by plotting
first with lines and then on top of that doing
quiver(x[1:],y[1:],u,v, pivot='tip', angles='xy')

Thanks,
Alan

···

On 11/29/2009 12:10 PM, Eric Firing wrote:

quiver(x[:-1], y[:-1], u, v, angles='xy', units='x', scale=1)

Alan G Isaac wrote:

quiver(x[:-1], y[:-1], u, v, angles='xy', units='x', scale=1)

That works perfectly when there is change only in x,
but not when both coordinates change. It seems like
I want a `units='xy'` option, to get the right
scaling along each axis, but it does not exist.

Actually, in svn there is such an option, but it still doesn't seem to do exactly the right thing in this case. I haven't yet figured out why not.

Eric

···

On 11/29/2009 12:10 PM, Eric Firing wrote:

However I can "fake it" pretty well by plotting
first with lines and then on top of that doing
quiver(x[1:],y[1:],u,v, pivot='tip', angles='xy')

Thanks,
Alan

OK, looking forward ...

Thanks,
Alan

···

On 11/29/2009 11:44 PM, Eric Firing wrote:

in svn there is such an option, but it still doesn't seem to
do exactly the right thing in this case

Alan G Isaac wrote:

···

On 11/29/2009 11:44 PM, Eric Firing wrote:

in svn there is such an option, but it still doesn't seem to
do exactly the right thing in this case

OK, looking forward ...

Try svn 7993 with "scale_units='xy', angles='xy', scale=1".
Having a separate "scale_units" kwarg is in the trunk only.

Eric