[R] Creating tiff with 1200 dpi

Peter Langfelder peter.langfelder at gmail.com
Wed Oct 3 21:03:34 CEST 2012


Well, if I read the error message right, your image is too large. I
think you should explore alternate formats - does the journal accept
figures in a vector format such PS, EPS or PDF?  Such figures will be
much easier to handle than a humongous tiff with file size of 60+
megabytes.

HTH,

Peter


On Wed, Oct 3, 2012 at 11:05 AM, Sheppard,Jennifer [Sas]
<Jennifer.Sheppard at ec.gc.ca> wrote:
> Hi all,
>
> I am trying to create images in R suitable for journal publication. I'd
> like to make an image that is 3.6" wide and 5.08" length, and 1200 dpi.
> When I create a tiff file that is 800 dpi and 4x4", it works (although
> doesn't look good).
> But when I create a tiff that is the size and dpi I want, it doesn't
> work. I get the following error:
>
> Error in tiff(filename = "C:\\Documents and
> Settings\\sheppardj\\Desktop\\Manuscripts\\Figure 6c.tif",  :
>   unable to start tiff() device
> In addition: Warning messages:
> 1: In tiff(filename = "C:\\Documents and Settings\\sheppardj\\Desktop\\
> Figure 6c.tif",  :
>   Unable to allocate bitmap
> 2: In tiff(filename = "C:\\Documents and Settings\\sheppardj\\Desktop\\
> Figure 6c.tif",  :
>   opening device failed
>
> I've tried the same thing with jpeg, and still get the same error. I've
> tried Cario, but I get an error that tiff bitmap is not supported.
>
> Any help would be appreciated. Here is my code.
>
> #Creating dataframes
> new.data2<-expand.grid(FCOND=23.5, FPC1=-0.68, MCOND=22.4, MPC1=-0.82,
> RANK=c(6:15))
> new.data3<-expand.grid(FOCND=39.1, FPC1=0.46, MCOND=7.4, MPC1=1.3,
> RANK=c(4:16))
> x2<-data.frame(mod.avg.pred=c(0.28, 0.26, 0.24, 0.23, 0.22, 0.21, 0.20,
> 0.19, 0.19, 0.18),
> uncond.se=c(0.17, 0.15, 0.14, 0.14, 0.15, 0.16, 0.18, 0.19, 0.20, 0.21))
> x3<-data.frame(mod.avg.pred=c(0.19, 0.22, 0.26, 0.32, 0.39, 0.47, 0.54,
> 0.61, 0.66, 0.70, 0.73, 0.75, 0.77),
> uncond.se=c(0.18, 0.17, 0.16, 0.14, 0.13, 0.14, 0.18, 0.22, 0.24, 0.26,
> 0.27, 0.28, 0.28))
>
> #creating a graph that works
> ## you'll have to direct this file to your own computer
>
> tiff(filename = "C:\\Documents and Settings\\sheppardj\\Desktop\\ Figure
> 6b.tif",
> width=3200, height=3200, units = "px", res = 800)
> par(mfrow=c(1,1))
> par(mar=c(6,6,2,2))
> plot(x2$mod.avg.pred~new.data2$RANK,cex.main=2,main="",
> ylab="Brood Survival",type="b",ylim=c(0:1), xlab="Male Plumage Score",
> pch=17, cex=1.5,cex.axis=2,cex.lab=2.5)
> points(x3$mod.avg.pred ~ new.data3$RANK, pch=19, col="gray45", cex=1.5,
> type="b")
> lines(new.data2$RANK, x2$mod.avg.pred + x2$uncond.se,lwd=2, lty=2)
> lines(new.data2$RANK, x2$mod.avg.pred - x2$uncond.se,lwd=2, lty=2)
> lines(new.data3$RANK, x3$mod.avg.pred + x3$uncond.se, lwd=2,lty=2,
> col="gray45")
> lines(new.data3$RANK, x3$mod.avg.pred - x3$uncond.se,lwd=2,lty=2,
> col="gray45")
> legend("topleft", c("Large Males", "Small Males"), pch= c(19, 17), col=
> c("gray45", "black"), lwd=2, cex=1.5)
> dev.off()
>
> #creating a graph that works
> ## you'll have to direct this file to your own computer
>
> tiff(filename = "C:\\Documents and Settings\\sheppardj\\Desktop \\Figure
> 6c.tif",
> width=4320, height=6096, units = "px", res = 1200)
> par(mfrow=c(1,1))
> par(mar=c(6,6,2,2))
> plot(x2$mod.avg.pred~new.data2$RANK,cex.main=2,main="",
> ylab="Brood Survival",type="b",ylim=c(0:1), xlab="Male Plumage Score",
> pch=17, cex=1.5,cex.axis=2,cex.lab=2.5)
> points(x3$mod.avg.pred ~ new.data3$RANK, pch=19, col="gray45", cex=1.5,
> type="b")
> lines(new.data2$RANK, x2$mod.avg.pred + x2$uncond.se,lwd=2, lty=2)
> lines(new.data2$RANK, x2$mod.avg.pred - x2$uncond.se,lwd=2, lty=2)
> lines(new.data3$RANK, x3$mod.avg.pred + x3$uncond.se, lwd=2,lty=2,
> col="gray45")
> lines(new.data3$RANK, x3$mod.avg.pred - x3$uncond.se,lwd=2,lty=2,
> col="gray45")
> legend("topleft", c("Large Males", "Small Males"), pch= c(19, 17), col=
> c("gray45", "black"), lwd=2, cex=1.5)
> dev.off()
>
>
>
>
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list