[R-SIG-Mac] Odd quartz behavior on 24" iMac at 10.7.5

Simon Urbanek simon.urbanek at r-project.org
Tue Oct 16 03:32:02 CEST 2012


Ray,

On Oct 15, 2012, at 8:57 PM, Ray Spence wrote:

> All,
> 
> There seems to be something wrong between OS X 10.7.5 and how
> quartz reads Apple graphics resolution on 24" iMac (early 2008,
> iMac8,1) on R 2.15.1 GUI1.52. On this hardware/OS/R version the
> default R plot is a rectangle.

Can you attach a screenshot? R is simply reading the geometry reported by the OS to adjust the aspect ratio accordingly.

Can you run this in R:

install.packages("inline") # if you don't have inline installed yet
library(inline)
f=cfunction(,'CGDirectDisplayID md = CGMainDisplayID(); CGSize ds = CGDisplayScreenSize(md); Rprintf("%gmm x %gmm\\n", ds.width, ds.height); return ScalarReal(ds.width / ds.height);','#include <ApplicationServices/ApplicationServices.h>')
f()

You should see this on a 24" iMac8,1:

> f()
520mm x 320mm
[1] 1.625

Those are the proper dimensions of the built-in screen.

If that's not what you get, you should be able work around this by setting dpi manually to 94 (it will be slightly off since the native dpi is asymmetric 93.785 x 95.25 but 94 should be close enough to not notice) - either in quartz.options() or quartz().

Cheers,
Simon



> On same hardware/R version running
> OS X 10.7.4 the default R plot is square as expected. (I don't see
> this behavior on 20" iMac once upgraded to 10.7.5.)
> 
> On this problematic iMac, if I run quartz.options() without changing
> anything I see:
> 
>> quartz.options()
> 
> $title
> 
> [1] "Quartz %d"
> 
> $width
> 
> [1] 7
> 
> $height
> 
> [1] 7
> 
> $pointsize
> 
> [1] 12
> 
> $family
> 
> [1] "Helvetica"
> 
> $fontsmooth
> 
> [1] TRUE
> 
> $antialias
> 
> [1] TRUE
> 
> $type
> 
> [1] "native"
> 
> $bg
> 
> [1] "transparent"
> 
> $canvas
> 
> [1] "white"
> 
> $dpi
> 
> [1] NA
> 
> But any plot, eg.
> >plot (rnorm(10),rnorm(10))
> 
> returns an image that is most definitely not a square.
> 
> Can anyone help me investigate this? For instance where/how
> does R create the plot graphic? Are there specific OS X file(s) that R
> reads to generate the plots?
> 
> My assumption is that this is an Apple Inc. generated problem
> but figured that the R community might be a bit more responsive..
> 
> Thanks,
> Ray
> 
> -- 
> *******************
> Raymond Spence
> U.C. Berkeley
> Dept. of Statistics
> SCF Sysadmin
> 497 Evans Hall
> U.C. Berkeley
> 510.642.5497
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 



More information about the R-SIG-Mac mailing list