From: Chris <bi...@Fu...> - 2004-11-08 08:20:27
|
Thanks a lot for the very very detail reply. I can not find the time to do it by myself at the moment. I will come back to this issue again after 2 two weeks. Best regards, Chris John Hunter wrote: >>>>>>"Chris" == Chris <Ch...@Fu...> writes: > > > Chris> Dear friends, I just start to use matplotlib, which looks > Chris> quite promising for me. I need to draw a couple of arrows > Chris> in my 2D plot. Is there a simple way to get it work? > > Chris> Any suggustions are welcome. > > I recommend creating an arrow class, derived from matplotlib.artist.Artist, that > contains a matplotlib.lines.Line2D for the arrow stem and a > matplotlib.patches.RegularPolygon with numVertices=3 for the arrow > head. You can control the rotation of the arrowhead with the > orientation argument. > > Once you have this class so defined, you can add it instances of it to > the axes with ax.add_artist(arrow). > > I'll be happy to help out with a prototype if you have trouble. Take > a look at matplotlib.table.Cell, which John Gill wrote to support > tables. You can use this as a simple model for how to write new > artists (things that draw into a figure) composed of other artists. > > It would be nice to have a fancy arrow class, that supported text > labeling, at the base, along the stem and at the arrowhead. You could > also consider a more sophisticated polygon other than a triangle for > the arrowhead. > > Finally, if you needed to draw *a lot of arrows*, order of a thousand > or more (eg for direction fields), a > matplotlib.collections.PolygonCollection would be the way to go for > efficiency. > > JDH > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click |