From: Chris <bi...@Fu...> - 2004-11-16 16:47:37
|
Dear John, I see your points. However, after I changed to using add_artist. This is still nothing on the canvas. I think that there is some problem with the draw function of my arrow class. I have no idea what else should be there. At the moment, only one call in my case as below. def draw(self, renderer): self._stem.draw(renderer) Could u tell what else should be called? Best regards, Chris John Hunter wrote: >>>>>>"Chris" == Chris <bi...@Fu...> writes: > > > Chris> I tried with what you suggested to make an Arrow class. To > Chris> begin with, I only put an Line2D instance. I searched for > Chris> table stuff in axes.py, matlab.py to make the arrow > Chris> importable from matplotlib.matlab. Then I also try a very > Chris> very simple demo and I expect to see a simple > Chris> line. However, I can not see it. Could someone tell me what > Chris> is the problem. Here is my very very rudimental codes. > > Nowhere in your code do you actually draw the arrows in self.arrows. > In Axes.draw you would need to do > > for arrow in self.arrows: > arrow.draw(renderer) > > And this should work. > > However, you can avoid all the overhead of add_arrow, and keeping a > list of arrows in self.arrows simply by doing > > > def arrow(self, x, y, *args, **kwargs): > a = Arrow(x,y, *args, **kwargs) > self.add_artist(a) > ^^^ > return a > > Ie, call add_artist which is a generic method for adding artists to > the axes. > > Hope this helps, > JDH > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: InterSystems CACHE > FREE OODBMS DOWNLOAD - A multidimensional database that combines > robust object and relational technologies, making it a perfect match > for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8 |