[R] Truncated plot in the output file

David Winsemius dwinsemius at comcast.net
Sun Sep 20 16:16:15 CEST 2009


On Sep 20, 2009, at 9:25 AM, J Chen wrote:

>
> Dear all,
>
> I made a large plot and wanted to save it as a tif file.
>
> I first opened and specified the size of the window.
>
> windows(12,17,rescale="fixed")
>
> Then I plot a heatmap using heatmap()
>
> when I saved the plot by using "Save as" in the file menu or
> savePlot("heatmap", type="tif"), the plot in the output tif file is
> truncated. Only the upper part of the plot is shown.
>
> I did get a complete plot if I used
>
> savePlot("heatmap.tif")
>
> but the tif file then cannot be opened in Photoshop, saying it is  
> not the
> right kind of document.
>
> Any ideas how I can solve the problem?


?tiff
?capabilities

Use the tiff device and specify the size you want. I'm assuming that  
those units were in inches for your situation.

Modified from the help page:

 > tiff(file="myplot.tif", bg="transparent", width=12, height=17,  
units="in", res=150)
 > plot(1:10); rect(1, 5, 3, 7, col="white")
 > dev.off()

(On my machine capabilities() tells me that I don't have a tiff device  
but experimentations suggests that information may not be entirely  
correct.)

-- 
David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list