[R] problem with labeling plots, possibly in font defaults

David Winsemius dwinsemius at comcast.net
Fri Aug 8 00:24:46 CEST 2014


On Aug 7, 2014, at 12:59 PM, Tim Blass wrote:

> Hello,
> 
> I am using R 3.1.1 on a (four year old) MacBook, running OSX 10.9.4.
> 
> I just tried making and labeling a plot as follows:
> 
>> x<-rnorm(10)
>> y<-rnorm(10)
>> plot(x,y)
>> title(main="random points")
> 
> which produces a scatter plot of the random points, but without the title
> and without any numbers along the axes. If I then run
> 
>> par(family="sans")
>> plot(x,y,main="plot title")
> 
> the plot has the title and the numbers on the axes (also and 'x' and 'y'
> appear as default labels for the axes).
> 
> I do not know what is going on, but maybe there is some problem in the
> default font settings (I don't know if that could be an R issue or an issue
> specific to my Mac)?

It hasn't happened to me recently (since updating from Leopard and SnowLeapard to Lion)  but it used to happen pretty frequently that I would get a duplicate font that printed empty square boxes. (I wasn't the only one. It got reported several times on R-SIG-Mac.)  One could fix that sort of problem by deleting the offending duplicate entry using Font Book.app

Since this is happening with the default serif font,  you would probably find the duplicate in Times. (It used to be happening to me with Symbol.)

> quartzFonts()$serif
[1] "Times-Roman"      "Times-Bold"       "Times-Italic"     "Times-BoldItalic"
>


> 
> This is clearly not a big problem (at least for now) since I can put labels
> on plots by running par(), but if it is indicative of a larger underlying
> problem (or if there is a simple fix) I would like to know.
> 
> Thank you!

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list