Dear R users, I 'm having problems with creating PNG graphic outputs. Usualy i create reports in HTML format, containing PNG graphics, so they can ealsaly be exported to word and xl and so on. On a windows pc that i use at work all works fine, but it never works on my mac. The HTML's i create on windows, open under safari but the graphics never open? is there a way of creating gif's for example?
Then i was wondering whether there is a less codeing intensif way to create plots? What i mean is, when i create a plot, existing out of 4 subplots, and i want to save it as a PNG to incorporate it in to a HTML.output i need to creat every plot under the PNG declaration. # png(filname.. # parset <- par(mfrow = c(2,2), oma = c(0,0,1,0),..]) # plot(... # plot(... # plot(... # plot(... # par(parset) # dev.off() Now, because i create graphs for different people, i usualy generate them in differerent sizes and configurations. So they just have to choose wich one to use in their text. There for i am looking for a way of programming that can save time and space yet the example below does not work, it only writes tables of data # plot.1 <- plot(... # plot.2 <- plot(... # plot.3 <- plot(... # plot.4 <- plot(... # # png(.. # plot.1 # dev.off() # ... # png(filname.. # parset <- par(mfrow = c(2,2), oma = c(0,0,1,0),..]) # plot.1 # plot.2 # plot.3 # plot.4 # par(parset) # dev.off() Here is an example of how i create the png files that i use in the HTML outputs. # size2 <- 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) ) # # for(rol in 1:4) { # save_at <-file.path(ResultDir,as.character(size[rol,5])) # setwd( save_at) # x11() # png(filename = paste("graf_1",size[rol,1],".png",sep=""),width = size[rol,2], height = size[rol,3],pointsize = size[rol,4], bg = "white", res = NA, restoreConsole = TRUE) # parset <- par(mfrow = c(2,2), oma = c(0,0,1,0),cex.axis=size[rol,6],cex=size[rol,6]) # boxplot(bxpdtrail$value,ylab="log10 (x)", main=paste("Mean",testname,"at",fase,sep=' ')) # points(1 ,mean(bxpdtrail$value,na.rm=T), pch = 19) # arrows(1 , upper(bxpdtrail$value,na.rm=T) , 1 , lower(bxpdtrail$value,na.rm=T), lty=3, code = 3, angle = 45, length = .1) # pyramid.plot(pyramiddata$yes,pyramiddata$no,main="Observation of Protection",labels=pyramiddata$L1,labelcex=size[rol,6], top.labels = c("Protected", "log10(x)", "Unprotected"),xycol=xycol,xxcol=xxcol,gap=8 ,unit = "# animals") # barplot(pyramiddata$prob_dens,names=pyramiddata$L1,ylab="EPP %", xlab="log10(x) ",main="Probability density plot") # plot(pyramiddata$L1,pyramiddata$prob_cum, ylab="EPP %", xlab="log10(x) ",main="Cumulative Probability plot", type="S") # par(parset) # dev.off() # } kind regards, Tom. Disclaimer: click here [[alternative HTML version deleted]] ______________________________________________ R-help@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.