[R] How to set plot resolution

Ben Bolker bolker at ufl.edu
Tue Dec 30 14:49:51 CET 2008


bioshaw <bioshaw <at> qq.com> writes:

> 
> Hi 
>  I'm want to obtain a  plot of 1200dpi tiff format, but I met some difficulty.

>   my code:
> ##############################################
> tiff(file="shaw.tiff",width=8.6,height=8.6,units="cm",res=1200,pointsize=10)
> plot(bal100,type="l",pch=20,col="red",lwd=1.5,axes=F,xlim=c(1,5),
ylim=c(0,0.3),ann=F)
> par(new=T)
> plot(bal80,type="l",pch=20,col="blue",lwd=1.5,axes=F,xlim=c(1,5),
ylim=c(0,0.3),ann=F)
> ....
> ##################################################
> > source("plot_data6.txt")
> Error in tiff(file = "shaw.tiff", width = 8.6, height = 8.6, units = "cm",  : 
>   unable to start device
> In addition: Warning messages:
> 1: In tiff(file = "shaw.tiff", width = 8.6, height = 8.6, units = "cm",  :
>   Unable to allocate bitmap
> 2: In tiff(file = "shaw.tiff", width = 8.6, height = 8.6, units = "cm",  :
>   opening device failed
> 

  Worked for me.  Do you have memory or disk space problems?
I would try reducing the resolution a bit to see if that works
(I know that won't solve your problem but it will help
diagnose it).

> tiff(file="test.tiff",width=8.6,height=8.6,units="cm",
    res=1200,pointsize=10)
> plot(1:100,1:100)
> dev.off()
null device 
          1 
> q()
Save workspace image? [y/n/c]: n


-rw-r--r--  1 ben ben 49499724 2008-12-30 08:46 test.tiff


ben at bolker-lap2:~$ display test.tiff

ben at bolker-lap2:~$ ls -lh test.tiff
-rw-r--r-- 1 ben ben 48M 2008-12-30 08:46 test.tiff



More information about the R-help mailing list