It is a bug, but the broken behavior was kept for backward 
compatibility.  Try setting the vertical alignment to 'baseline'.

import matplotlib.pyplot as plt
fig=plt.figure()
plt.text(0.4,0.5,"some text", verticalalignment='baseline')
plt.text(0.6,0.5,"some text with a g in it", verticalalignment='baseline')

It's probably about time to fix this -- we will have to update many of 
the unit tests -- what do the rest of the devs think?

Mike

On 05/20/2010 10:28 AM, Nick Schurch wrote:
> I've also discovered another text problem. If I add two lines of test
> to a plot as follows:
>
> import mapplotlib.pyplot as plt
> fig=plt.figure()
> plt.text(0.4,0.5,"some text")
> plt.text(0.6,0.5,"some more text")
>
> then the two sets of text line up nicely with each other, because they
> have the same y-axis position. But if I do:
>
> import mapplotlib.pyplot as plt
> fig=plt.figure()
> plt.text(0.4,0.5,"some text")
> plt.text(0.6,0.5,"some text with a g in it")
>
> then the "some text with a g in it" is shifted upwards slightly so
> that the bottom of "some text" lines up with the bottom of the "g",
> and doesn't line up witht he rest of the letters. It look like they
> are not on the same line! This has got to be a bug in the way
> matplotlib deals with text.
>
> --
> Cheers,
>
> Nick Schurch
>
> Data Analysis Group (The Barton Group),
> School of Life Sciences,
> University of Dundee,
> Dow St,
> Dundee,
> DD1 5EH,
> Scotland,
> UK
>
> Tel: +44 1382 388707
> Fax: +44 1382 345 893
>
>
>
>    


-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


------------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to