From: SourceForge.net <no...@so...> - 2004-06-29 15:37:48
|
Bugs item #977323, was opened at 2004-06-22 11:25 Message generated for change (Comment added) made by wobsta You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=442886&aid=977323&group_id=45430 Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Marko Vendelin (tmp001) Assigned to: André Wobst (wobsta) Summary: rater.py: division by Zero Initial Comment: I would like to report a bug (or rather strange feature :) ) in pyx/graph/axis/rater.py. If I specify limits of axis equal to [12.5 to 1050] then pyx crashes somewhere in rater.py: ------ Example program: from pyx import * g = graph.graphxy(height=8, width=8, x=graph.axis.linear(min=12.5, max=1050, title=r"\large{X}"), y=graph.axis.linear(title=r"\large{Y}") ) g.plot( graph.data.list( [[0, 50], [10, 50]], addlinenumbers=0, x=0, y=1), graph.style.line(lineattrs=[style.linewidth.thick,style.linecap.round]) ) g.writetofile("test.eps") ------- Output: Traceback (most recent call last): File "test.py", line 10, in ? g.writetofile("test.eps") File "/home/markov/python/graphics/PyX-0.6.3/pyx/canvas.py", line 533, in writetofile self.writeEPSfile(filename, *args, **kwargs) File "/home/markov/python/graphics/PyX-0.6.3/pyx/canvas.py", line 367, in writeEPSfile abbox = bbox is not None and bbox or self.bbox() File "/home/markov/python/graphics/PyX-0.6.3/pyx/graph/graph.py", line 418, in bbox self.finish() File "/home/markov/python/graphics/PyX-0.6.3/pyx/graph/graph.py", line 368, in finish self.domethods[0]() File "/home/markov/python/graphics/PyX-0.6.3/pyx/graph/graph.py", line 310, in dolayout axis.finish(self.axespos[key]) File "/home/markov/python/graphics/PyX-0.6.3/pyx/graph/axis/axis.py", line 313, in finish newrate = self.rater.rateticks(self, newticks, self.density) File "/home/markov/python/pyx/graph/axis/rater.py", line 193, in rateticks return rate/weight ZeroDivisionError: integer division or modulo by zero cheers, Marko ---------------------------------------------------------------------- >Comment By: André Wobst (wobsta) Date: 2004-06-29 17:37 Message: Logged In: YES user_id=405853 Thanks for reporting this issue and sorry for my late response. The problem is, that a partitioner might return an empty list of ticks but was not considered in the code. This behaviour of the partitioner is also beyond to be changed. Its also interesting to see your example, where you step into that problem even for the default parameters of the automatic linear partitioner. To solve the problem at least the axis need to take care of this special case. (While the axis must take care of it, the rater might not even be asked for such a case.) A patch is enclosed. Note, that you will get an error from the partitioner for the y axis in your example, but this is due to the y range from 50 to 50. I do not consider this later issue to be a bug. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=442886&aid=977323&group_id=45430 |