Re: [R] plotmath "overstrikes" in output on a Linux system

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue, 08 Apr 2008 10:29:06 +0100 (BST)

Looks likes the the laptop is using different fonts with incorrect font metrics. This could happen because it has a different screen resolution, or one of the systems is set to use scalable fonts or it is giving metrics for one fonts and using another or ....

BTW, this is probably nothing to do with plotmath per se -- the issue is most likely the device (presumably X11(), but you did not say) and its handling of font metric requests. It looks to me as if the widths of normal text strings (and not symbols) is the problem. I have seen something similar where there was a long-standing bug in plotmath (fixed in r44534), but this only manifested itself when text was kerned, which the X11() device in 2.6.2 does not ask for.

My best guess is that the font selected is (to use the technical terms) returning glyph widths without left/right bearings.

Please try 2.7.0 beta, which has a different X11() device (and the above bug fixed). That ought to solve the problem for you, but otherwise you'll need to debug what the X11 metricInfo callback is giving you.

On Tue, 8 Apr 2008, Paul Johnson wrote:

> I've been testing plotmath. But I'm getting some funny output one one
> computer. The problem is that characters are 'jumbled' and overstrike
> when symbols are introduced.
>
> Sample code:
>
> mu <- 440.0
> sigma <- 12.5
> myx <- seq( mu - 4*sigma, mu+ 4*sigma, length.out=500)
> myDensity <- dnorm(myx,mean=mu,sd=sigma)
>
> # Here's one way to retrieve the values of mu and sigma and insert
> them into an expression
> t1t2 <- bquote (paste("Normal(", mu== .(mu), ',', sigma== .(sigma),")") )
>
> plot(myx, myDensity, type="l", xlab="X", ylab="Probability Density ", main=t1t2)
>
>
> I have tested this code and it works on two desktop Fedora Linux 8
> systems to make a nice figure, but on a Dell Laptop with Fedora Linux
> 8 and R 2.6.2, something funny happens: the characters "overstrike"
> each other. The Greek letter "mu" is printed several spaces to the
> left of the "(" that it is supposed to follow. I made an itty bitty
> picture of the figure title to show you:
>
> http://pj.freefaculty.org/R/plotmath_problem.png
>
> I can force in spaces to re-arrange the symbols so they do not
> overstrike. The following looks fine in the output.
>
>
> t1t2 <- bquote (paste("Normal ( ", mu== .(mu), ' , ', sigma==
> .(sigma)," )") )
> ### Note spaces manually inserted above are needed, otherwise plotmath
> overlaps "l" of
>
> plot(myx, myDensity, type="l", xlab="X", ylab="Probability Density ", main=t1t2)
>
>
> What do you suppose is wrong? The X configuration?
>
>
> --
> Paul E. Johnson
> Professor, Political Science
> 1541 Lilac Lane, Room 504
> University of Kansas

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 08 Apr 2008 - 09:33:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Apr 2008 - 19:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive