From: Dominique O. <Dom...@po...> - 2004-12-22 05:29:07
|
Hi, Based on John's advice in a previous post about designing an Arrow class (http://sourceforge.net/mailarchive/message.php?msg_id=9962785), i have restarted from scratch, defining the stem as a Line2D instance and the head as a RegularPolygon instance (for now, a triangle). I can correctly set the orientation of the arrow head, and from debugging information, the class seems to be basically working. The class is imported in axes.py and i have defined the new methods add_arrow() and arrow() in Axes. Arrows are stored in a list called arrows (i know John advised to avoid the overhead of that---i am simply trying to get it to work first). Now, i know i am missing something (and this must be at the heart of matplotlib): how are 'figure coordinates' transformed into 'axes corrdinates'? I guess it has to do with the 'transforms' module but.... For instance, if i say arrow( [0,1], [0,1] ) with the intent of drawing an arrow from (0,0) to (1,1), i can't see the graphical result. Now if i say arrow( [0,100], [0,100] ) I can see something (the arrow head). And this may or may not be the source of my 2nd problem: the arrow head is drawn, but not the stem (as in the thread linked to above). The draw() method of my Arrow class is very simple: self._stem.draw(renderer) self._head.draw(renderer) Any help would be greatly appreciated. I'll be happy to add spiff to the Arrow class once i have a basic version of it working and contribute it to matplotlib. I can post some code if you would like; i just thought it would be too long in a mailing list... Thanks, Dominique ps: Thanks for the matplotlib manual! -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.296 / Virus Database: 265.6.3 - Release Date: 12/21/2004 |