[R] problems writing graphics

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Jan 17 15:27:03 CET 2003


Juan Ramon Gonzalez wrote:
> Hello R-listers,
> 
> I am developing a function which needs to create jpeg files from some plots. To create the jpeg files I use the instruction dev.print(jpeg, file=c://graph.jpg",width=400,height=400). 
[won't work anyway]

Until now everything has been fine, but now I have a special plot which 
is formed by 3 separate plots joined with the instruction "layout":
> 
> nf <- layout(matrix(c(2,0,1,3),2,2,byrow=TRUE), c(3,1), c(1,3), TRUE);
> layout.show(nf);
> 
> 
> The graphic in R is ok, but the problem comes when I try to change the size of the graphic in the function dev.print, as it seems to not expand the layout graphic to the size I have chosen (it creates an image with the right size, but expanding the margins and not the image itself, while with "normal" plots the image is expanded). Anyone could tell me how to change the size of the image? 
> 
> Thank you in advance,
> 
> Juan

Use dev.copy() instead (it redraws the figure, see ?dev.copy), or even 
better use the jpeg() device directly, if you are on Windows.

Uwe Ligges




More information about the R-help mailing list