Skip to content
Prev 10189 / 63424 Next

plotmath under windows (PR#3672)

If it occurs on plotmath it will also occur on screen (and it does for 
me on WinXP).

Why do you think this is a bug?   IT IS intentional.  Please don't waste 
our time reporting things you don't understand as bugs -- see the FAQ and 
ask for help on R-help/R-devel first.  In particular, your claim is false 
(it is only including characters which have descenders that has the 
effect, and more careful chacking might have made you realise this was a 
feature).

If you plot different labels they will have different heights and depths
(and different heights/depths under different fonts), and that is taken
into account.  It often is not clear where the baseline on a plotmath
expression is, and it is taken as the bottom of the bounding box, whereas 
for character vectors the baselines are the baselines of the strings.

The Windows and postscript font metrics are not the same, and it may well
be the case (and Uwe Ligges' report suggests so) that Windows font metrics
differ by version of Windows, something I think we have met before.

The exact cause here is that many of your plotmath expressions contain a
space, and in WinXP, a space extends below as well as above the line.  So
paste(40 * degree, " ",30 * minute) has space at the bottom of its
bounding box, and 40 does not.  It is precisely the plotmath expressions
containing spaces which are raised.

If you would like to change the behaviour, please submit a patch (against 
the current R-devel code) for us to test.

Here is a small example of alignment for you to ponder

plot(1:10, type="n")
text(1:2, 2, c("i", "j"), adj=c(0.5, 0))
text(3:4, 2, expression("i", "j"), adj=c(0.5, 0))
abline(h=2)

Try it under postscript() as well. So your patch will need to establish
the correct baseline for plotmath expressions.  We look forward to your 
positive contributions to R.
On Thu, 7 Aug 2003 mh.smith@niwa.co.nz wrote:

            
Not true.  expression(paste(40 * degree, "S")) is not displaced here.