[R] How to set plot resolution

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Dec 30 16:21:09 CET 2008


I think it should work on any reasonable machine, but it is worth pointing 
out that there are 4 separate tiff() devices:

Unix, X11
Unix, cairo,
Mac OS X, quartz,
Windows, graphapp

and once again we really did need the OS information asked for in the 
posting guide.  As I recall Ben uses one of the first two, and the error 
message looks like the fourth.

Also, the file size will depend on the contents, and the example was not 
reproducible.  (It is likely to be ca 48 or 64 Mb, though, depending if 
transparency is used.)


On Tue, 30 Dec 2008, Ben Bolker wrote:

> 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
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list