Plotting vectors (arrows) on a manifold

Sam Smith is having trouble posting to the list, so I'm posting this
form him

···

From: "Samuel M. Smith" <smithsm@...755...>
Date: 04 October, 2005 22:52:57 MDT
To: matplotlib-users@lists.sourceforge.net
Cc: "Samuel M. Smith" <smithsm@...755...>
Subject: Plotting vectors (arrows) on a manifold

I need to plot vectors along a manifold (curve). The quiver plot
AFAI can tell only plots arrows on a grid not just
along a curve. In general I need a scatter plot where each plotted
point is a vector. where (x,y) is the base of vector
and (u,v) is the vector. The plot could take in arrays X Y U V
where as in the quiver plot X Y U V are matrices.

Anyone have any suggestions how I might go about generating such a
plot even if I have to do it by repurposing something else.
In general how would I position an arbitrary arrow somewhere on a
plot?

I suppose I could brute force it by superimposing 3 line plots for
each arrow where each plot draws one part of the arrow ( body, left
head, right head). This amounts to a lot of plots. Is there a
better way?

What would also be useful is a combination of a comet plot with an
arrow pointing in the direction the comet is moving.
This would be great for animation.

**********************************************************************
Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84043
801-768-2768 voice
801-768-2769 fax
**********************************************************************
"The greatest source of failure and unhappiness in the world is
giving up what we want most for what we want at the moment"
**********************************************************************

There's a patch from me on the devel list from sometime ago which
contains a patch to add an arrowhead marker style to lines. This
obviously isn't a solution but on the off chance its useful its here:
http://sourceforge.net/mailarchive/message.php?msg_id=12411835

Nick

···

On Wed, 2005-10-05 at 09:43 -0500, John Hunter wrote:

I need to plot vectors along a manifold (curve). The quiver plot
AFAI can tell only plots arrows on a grid not just
along a curve. In general I need a scatter plot where each plotted
point is a vector. where (x,y) is the base of vector
and (u,v) is the vector. The plot could take in arrays X Y U V
where as in the quiver plot X Y U V are matrices.

Anyone have any suggestions how I might go about generating such a
plot even if I have to do it by repurposing something else.
In general how would I position an arbitrary arrow somewhere on a
plot?

So to apply the patch I can manually edit lines.py
or can I just write my own function. I am not familiar with renderer.

Also your patch mentions a patch.arrow class. Where is that documented?

···

On 05 Oct, 2005, at 09:25, Nicholas Young wrote:

There's a patch from me on the devel list from sometime ago which
contains a patch to add an arrowhead marker style to lines. This
obviously isn't a solution but on the off chance its useful its here:
http://sourceforge.net/mailarchive/message.php?msg_id=12411835

>
> There's a patch from me on the devel list from sometime ago which
> contains a patch to add an arrowhead marker style to lines. This
> obviously isn't a solution but on the off chance its useful its here:
> http://sourceforge.net/mailarchive/message.php?msg_id=12411835
>

So to apply the patch I can manually edit lines.py
or can I just write my own function. I am not familiar with renderer.

Patches are normally applied using software (which does edit lines.py).
If you are using a *nix system this is patch if not I'm afraid I've no
idea.

All this patch does is automate the process of drawing three lines for
an arrow - as this isn't particularly difficult it might be simpler to
produce your own function if you aren't familiar with patches. The
patch is also against an old CVS version of matplotlib - I can produce a
more up to date one if you do want to use it.

Also your patch mentions a patch.arrow class. Where is that documented?

The classdoc documentation is here:
http://matplotlib.sourceforge.net/matplotlib.patches.html
To use this you create a patch then add it to the current axis using the
axes.add_patch function.

Nick

···

On Wed, 2005-10-05 at 13:06 -0600, Samuel M. Smith wrote:

On 05 Oct, 2005, at 09:25, Nicholas Young wrote: