[Matplotlib-users] Another text problem...

2010-05-20 Thread Nick Schurch
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



-- 
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

--

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


Re: [Matplotlib-users] Another text problem...

2010-05-20 Thread Michael Droettboom
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


Re: [Matplotlib-users] Another text problem...

2010-05-20 Thread Ryan May
On Thu, May 20, 2010 at 9:34 AM, Michael Droettboom md...@stsci.edu wrote:
 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?

I'm +1, but I've been bitten by this and am not concerned personally
with the backwards incompatibility. I'm not sure how much code out
there is dependant on this.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--

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


Re: [Matplotlib-users] Another text problem...

2010-05-20 Thread Michael Droettboom
On 05/20/2010 11:32 AM, Ryan May wrote:
 On Thu, May 20, 2010 at 9:34 AM, Michael Droettboommd...@stsci.edu  wrote:

 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?
  
 I'm +1, but I've been bitten by this and am not concerned personally
 with the backwards incompatibility. I'm not sure how much code out
 there is dependant on this.


I've made baseline the default in SVN r8330.  Only two of the unit tests 
changed due to this -- so hopefully it won't be too disruptive for users 
at large.

Mike

-- 
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