[R] Creating tiff with 1200 dpi

Guillaume Bal guillaume.bal.pro at gmail.com
Wed Oct 3 21:02:28 CEST 2012


I also had a lot of trouble to create the figs exactly as I want then 
using R alone.
Now, I generally create a postscript image in R and I use gimp after so 
I can easily modify the resolution.


On 10/3/2012 11:56 AM, David Winsemius wrote:
> On Oct 3, 2012, at 11:52 AM, David Winsemius wrote:
>
>> On Oct 3, 2012, at 11:05 AM, Sheppard,Jennifer [Sas] 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
>> So what does this return:
>>
>> capabilities()   # specifically, is tiff == TRUE?
>>
>>
>>> 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",
>> That prior line had space before "Figure". Don't think that is the source but you are on an OS that has a history of messing up on spaces in file names.
>>
>>
>>> 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()
>> It creates a rather strange graph on my machine.
> Substituting res=300 gave a much more sensible appearance.
>




More information about the R-help mailing list