## Re: [Matplotlib-users] bug somewhere called by draw_lines

 Re: [Matplotlib-users] bug somewhere called by draw_lines From: John Hunter - 2004-05-21 15:01:09 ```>>>>> "Andrew" == Andrew Straw writes: Andrew> matplotlib 0.54 numarray 0.9 python 2.2.1 windows XP Andrew> if I use WXAgg or Agg, I get this: Hmm, this is an I-can't-replicate-your-bugs-day. Using numarray 0.8 or 0.9 with matplotlib on linux, setting numerix : numarray in my rc file, I have no troubles with your script on any of a variety of backends. Apparently the data coming from the numerix transform is complex. The line that is failing for you is a tickline (as indicated by your traceback). These lines are small so it would be interesting to see by printing them if they are complex before of after being handed off to the transformation. In site-packages/matplotlib/lines.py on line 180, replace xt, yt = self._transform.numerix_x_y(x, y) with print 'before', x, y xt, yt = self._transform.numerix_x_y(x, y) print 'after', xt, yt and let me know what happens. If they are complex before then it appears complex data is being passed in; in this case try printing x,y in your script x = a*cos( theta )*exp(b*theta) y = a*sin( theta )*exp(b*theta) print 'x', x print 'y', y to see if you can find where these complexes are coming from. Thanks, JDH ```

 [Matplotlib-users] bug somewhere called by draw_lines From: Andrew Straw - 2004-05-20 22:21:12 ```when running the following simple script: from matplotlib.matlab import * from numarray import * theta = arange(0.0,8*pi,0.1) a=1 b=.2 dt = 0.0 x = a*cos( theta )*exp(b*theta) y = a*sin( theta )*exp(b*theta) plot(x,y) show() #savefig('ss') with the following combination of software: matplotlib 0.54 numarray 0.9 python 2.2.1 windows XP if I use WXAgg or Agg, I get this: Traceback (most recent call last): File "simple_spiral.py", line 13, in ? show() File "C:\Python22\Lib\site-packages\matplotlib\backends\backend_wx.py", line 1124, in show figwin.canvas.draw() File "C:\Python22\Lib\site-packages\matplotlib\backends\backend_wxagg.py", line 50, in draw agg.draw() File "C:\Python22\Lib\site-packages\matplotlib\backends\backend_agg.py", line 299, in draw self.figure.draw(self.renderer) File "C:\Python22\Lib\site-packages\matplotlib\figure.py", line 128, in draw for a in self.axes: a.draw(renderer) File "C:\Python22\Lib\site-packages\matplotlib\axes.py", line 603, in draw self.xaxis.draw(renderer) File "C:\Python22\Lib\site-packages\matplotlib\axis.py", line 463, in draw tick.draw(renderer) File "C:\Python22\Lib\site-packages\matplotlib\axis.py", line 125, in draw if midPoint and self.tick1On: self.tick1line.draw(renderer) File "C:\Python22\Lib\site-packages\matplotlib\lines.py", line 193, in draw self._lineFunc(renderer, gc, xt, yt) File "C:\Python22\Lib\site-packages\matplotlib\lines.py", line 326, in _draw_solid renderer.draw_lines(gc, xt,yt) TypeError: can't convert complex to float; use e.g. abs(z) if I use PS, I get this: Traceback (most recent call last): File "simple_spiral.py", line 14, in ? savefig('ss') File "C:\Python22\Lib\site-packages\matplotlib\matlab.py", line 1156, in savefig manager.canvas.print_figure(*args, **kwargs) File "C:\Python22\Lib\site-packages\matplotlib\backends\backend_ps.py", line 378, in print_figure self.figure.draw(renderer) File "C:\Python22\Lib\site-packages\matplotlib\figure.py", line 128, in draw for a in self.axes: a.draw(renderer) File "C:\Python22\Lib\site-packages\matplotlib\axes.py", line 603, in draw self.xaxis.draw(renderer) File "C:\Python22\Lib\site-packages\matplotlib\axis.py", line 463, in draw tick.draw(renderer) File "C:\Python22\Lib\site-packages\matplotlib\axis.py", line 125, in draw if midPoint and self.tick1On: self.tick1line.draw(renderer) File "C:\Python22\Lib\site-packages\matplotlib\lines.py", line 193, in draw self._lineFunc(renderer, gc, xt, yt) File "C:\Python22\Lib\site-packages\matplotlib\lines.py", line 326, in _draw_solid renderer.draw_lines(gc, xt,yt) File "C:\Python22\Lib\site-packages\matplotlib\backends\backend_ps.py", line 103, in draw_lines ps.append('newpath %s moveto' % _nums_to_str((x[0], y[0]))) File "C:\Python22\Lib\site-packages\matplotlib\backends\backend_ps.py", line 36, in _nums_to_str return ' '.join([_int_or_float(val, fmt) for val in seq]) File "C:\Python22\Lib\site-packages\matplotlib\backends\backend_ps.py", line 41, in _int_or_float ival = int(val) TypeError: can't convert complex to int; use e.g. int(abs(z)) ```
 Re: [Matplotlib-users] bug somewhere called by draw_lines From: John Hunter - 2004-05-21 15:01:09 ```>>>>> "Andrew" == Andrew Straw writes: Andrew> matplotlib 0.54 numarray 0.9 python 2.2.1 windows XP Andrew> if I use WXAgg or Agg, I get this: Hmm, this is an I-can't-replicate-your-bugs-day. Using numarray 0.8 or 0.9 with matplotlib on linux, setting numerix : numarray in my rc file, I have no troubles with your script on any of a variety of backends. Apparently the data coming from the numerix transform is complex. The line that is failing for you is a tickline (as indicated by your traceback). These lines are small so it would be interesting to see by printing them if they are complex before of after being handed off to the transformation. In site-packages/matplotlib/lines.py on line 180, replace xt, yt = self._transform.numerix_x_y(x, y) with print 'before', x, y xt, yt = self._transform.numerix_x_y(x, y) print 'after', xt, yt and let me know what happens. If they are complex before then it appears complex data is being passed in; in this case try printing x,y in your script x = a*cos( theta )*exp(b*theta) y = a*sin( theta )*exp(b*theta) print 'x', x print 'y', y to see if you can find where these complexes are coming from. Thanks, JDH ```
 Re: [Matplotlib-users] bug somewhere called by draw_lines From: Todd Miller - 2004-05-21 17:18:26 ```On Fri, 2004-05-21 at 10:38, John Hunter wrote: > >>>>> "Andrew" == Andrew Straw writes: > > Andrew> matplotlib 0.54 numarray 0.9 python 2.2.1 windows XP > > Andrew> if I use WXAgg or Agg, I get this: > > Hmm, this is an I-can't-replicate-your-bugs-day. I'm sorry I'm just catching up with this now. I made an error building matplotlib-0.54 for numarray on windows and the original version I sent John basically doesn't work with numarray-0.9, just numarray-CVS. The nature of the error is that function calls from C extensions to numarray are totally mismatched so all bets are off as to what extensions actually wind up doing. Sorry for the inconvenience, Todd Miller > Using numarray 0.8 or 0.9 with matplotlib on linux, setting numerix : > numarray in my rc file, I have no troubles with your script on any of > a variety of backends. > > Apparently the data coming from the numerix transform is complex. The > line that is failing for you is a tickline (as indicated by your > traceback). These lines are small so it would be interesting to see > by printing them if they are complex before of after being handed off > to the transformation. In site-packages/matplotlib/lines.py on line > 180, replace > > xt, yt = self._transform.numerix_x_y(x, y) > > with > print 'before', x, y > xt, yt = self._transform.numerix_x_y(x, y) > print 'after', xt, yt > > and let me know what happens. If they are complex before then it > appears complex data is being passed in; in this case try printing x,y > in your script > > x = a*cos( theta )*exp(b*theta) > y = a*sin( theta )*exp(b*theta) > print 'x', x > print 'y', y > > to see if you can find where these complexes are coming from. > > Thanks, > JDH > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Todd Miller ```