Skip to content
Prev 156421 / 398506 Next

PNG file don't run on mac's?

Tom,

First of all, please in the future follow the posting guide and 
include a reproducible example. Yours is not, because the objects 
named "bxpdtrail" and "ResultDir" (and maybe others) are not 
available to readers of this list. And you defined a dataframe named 
"size2" but then used one named "size". It's also puzzling why you 
would include an example in which every line was commented out.

That said, the following example works on my Mac. The png files are 
created and can be viewed by Preview.app. You might give it a try.


## note that the column names do not need to be quoted
size <- data.frame(adname=c("_small","","_big","_html"),
                     width=c(300,400,500,300), height = 
c(300,400,500,300), pointsize =
                     c(10,12,14,10),Directory=c(rep("graph",3),"html" 
), cexsize=
                     c(0.6,0.65,0.7,0.65) )
#

ResultDir <- 'emwout'
x11()

for(rol in 1:4) {
   save.at <- file.path(ResultDir,as.character(size[rol,5]))
   fname <- file.path(save.at,paste("graf.1",size[rol,1],".png",sep=""))
   cat('filename: ',fname,'\n')

   ## I have no idea what the restoreConsole argument in png() was 
supposed to do
   ## I don't see it documented in ?png. And 
help.search('restoreConsole') finds nothing. So I took it out.
   png(filename = fname, width= size[rol,2], height = size[rol,3], 
pointsize = size[rol,4], bg = "white" )

   parset <- par(mfrow = c(2,2), oma =  c(0,0,1,0), 
cex.axis=size[rol,6], cex=size[rol,6])

   plot(1:3,1:3)
   plot(3:1,3:1)
   plot(5:8,5:8)
   plot(8:5,8:5)

   par(parset)
   dev.off()
}

-Don

p.s.
It also looks like your email was line wrapped to perhaps 80 
characters, which makes it hard to read,
and also inconvenient to work with. If you can find a way to avoid 
that, it would be good.
At 11:37 AM +0200 9/18/08, Tom Willems wrote: