-
-
Notifications
You must be signed in to change notification settings - Fork 712
Closed
Description
This is an error to a custom patch that we have to the matplotlib code so that we can have arrows that are shortened by a certain number of points.
This week, I was drawing plot vector field using two ways : (1) plot_vector_field and (2) by simply suming up plenty of arrows as I wished. Since their was a fixed point somewhere, I came up with the problem of drawing a zero length arrow. Using sage 3.1.4, I get a zero division error. Where is this division from? The example below show that it is not from the slope as it can draw a vertical arrow.
sage: arrow((1, 1), (2, 1))
sage: arrow((1, 1), (1, 2))
sage: arrow((1, 1), (1, 1))
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last) :
...
/home/slabbe/sage/local/lib/python2.5/site-packages/matplotlib/arrow_line.pyc in draw(self, renderer)
100 pixel_vector = (orig_t.transform_point(points[1]) - orig_t.transform_point(points[0]))
101 pixel_length=math.sqrt(sum(pixel_vector**2))
--> 102 clip_fraction = renderer.points_to_pixels(self._arrowshorten)/pixel_length
103 head_clip_fraction = renderer.points_to_pixels(self._arrowshorten+self._arrowheadlength*0.8)/pixel_length
104
ZeroDivisionError: float division
In my problem, I would have been happy if arrow(x,x) would draw simply a point. I know I can define my own arrow but maybe sage's arrow could behave like myarrow ?
Component: graphics
Issue created by migration from https://trac.sagemath.org/ticket/4465