From baptiste.auguie at googlemail.com  Sat Apr 17 12:34:22 2010
From: baptiste.auguie at googlemail.com (baptiste auguie)
Date: Sat, 17 Apr 2010 12:34:22 +0200
Subject: [Rd] grid.cap() requires more time?
Message-ID: <o2kde4e29f51004170334y63ad9833n666b92518512961b@mail.gmail.com>

Dear all,

I am puzzled by the following behavior of the new grid.cap() function,
which appears to run out of time when capturing the output of a
graphic. It works fine if I introduce a Sys.sleep(1) before executing
more code,

library(grid)

quartz()
grid.circle(gp=gpar(fill="black"))
gg <- grid.cap()
dev.new()
grid.raster(gg) ## completely blank
gg[gg!="white"] ## indeed

quartz()
grid.circle(gp=gpar(fill="black"))
Sys.sleep(1)
gg <- grid.cap()
dev.new()
grid.raster(gg) ## OK
gg[gg!="white"]

I tried to see if the problem was limited to the quartz() device but
for some reason the x11() device is not working for me in this R
version,

capabilities(what = NULL)
    jpeg      png     tiff    tcltk      X11     aqua http/ftp
sockets   libxml     fifo   cledit    iconv      NLS  profmem    cairo
    TRUE     TRUE     TRUE     TRUE    FALSE     TRUE     TRUE
TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE
Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
  unable to load shared library
'/Library/Frameworks/R.framework/Resources/modules/i386/R_X11.so':
  dlopen(/Library/Frameworks/R.framework/Resources/modules/i386/R_X11.so,
6): Library not loaded: /usr/X11/lib/libpng12.0.dylib
  Referenced from:
/Library/Frameworks/R.framework/Resources/modules/i386/R_X11.so
  Reason: Incompatible library version: R_X11.so requires version
42.0.0 or later, but libpng12.0.dylib provides version 36.0.0

sessionInfo()
R version 2.11.0 RC (2010-04-16 r51754)
i386-apple-darwin9.8.0

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets
methods   base

loaded via a namespace (and not attached):
[1] tools_2.11.0

I would appreciate if someone could confirm this behavior. Pointers to
a fix for the x11() device on my machine are also welcome!

Best regards,

baptiste



[Rd] grid.cap() requires more time?
baptiste auguie