Hi all,
I think there may be a bug in annotate. If I don't have any offset
between the xcoord of xy and xytext I get a zero division error.
Otherwise it is fine. For example:
In [3]: plot([1,2,3],[1,2,3])
Out[3]: [<matplotlib.lines.Line2D instance at 0x8cec96c>]
In [4]: annotate('hello', xy=(2.0,2.0), xytext=(2.0,1.5),
arrowprops=dict(facecolor='black'))
···
---------------------------------------------------------------------------
<type 'exceptions.ZeroDivisionError'> Traceback (most recent call last)
<SNIP>
/usr/lib/python2.5/site-packages/matplotlib/patches.py in
getpoints(self, x1, y1, x2, y2, k)
665 """
666 x1,y1,x2,y2,k = map(float, (x1,y1,x2,y2,k))
--> 667 m = (y2-y1)/(x2-x1)
668 pm = -1./m
669 a = 1
<type 'exceptions.ZeroDivisionError'>: float division
It looks quite clear where the problem is. Though I'm not sure I'm up
to making a patch.
Cheers,
John