Greetings,

I am using matplotlib to generate an SVG plot containing a mixture of
Annotations and Circles. I noticed that the annotation text does not appear
at exactly the correct location when outputting to SVG. The difference is
minor, but definitely present.

The following will reproduce the problem in the form of two files, an svg
and a png:

------
from matplotlib.pyplot import figure
from matplotlib.text import Annotation
from matplotlib.patches import Circle
from matplotlib.transforms import IdentityTransform

f = figure(1)
a = f.add_subplot(111)
text = Annotation('H', (0.4, 0.4), va='center', ha='center',
size='xx-large', transform=IdentityTransform())
a.add_artist(text)
a.grid(True)
f.savefig("incorrect.svg")
f.savefig("correct.png")
------
IdentityTransform() is used to workaround a bug in add_artist() (see
http://www.nabble.com/Annotation-add_artist-bug-tt19052971.html )

Further investigation reveals that this problem occurs with ps and pdf
output as well. It seems that all backend_*.py files in
/usr/share/pyshared/matplotlib/backends suffer from this problem. I have
poked around in a few files but can't see any obvious fixes.

Has anyone encountered this problem before and found a decent workaround?

Thanks,
Craig
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to