SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: John T. <jt...@gm...> - 2007年05月29日 21:07:31
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
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /