[R] Maintain proportions while reducing graphic output size

Glen Sargeant gsargeant at usgs.gov
Mon Apr 6 19:07:12 CEST 2009




lawnboy34 wrote:
> 
> Hello,
> 
> Is there a combination of par() settings or other commands that will allow
> me to uniformly reduce the size of graphics outputs? It appears that the
> png() device outputs 5-inch by 5-inch  images, and I am trying to change
> my
> whole script to produce 4x4 images with the same proportions. I tried
> specifying parameters within each png(), but it reduced the size of the
> file
> without refitting the contents so the graph title went off the margin.
> This
> is an example of the code I used:
> 
> png("graph2.png",height=432, width=432, units="px", res=96)
> 
> What would be the best way to generate 4x4, proportional graphs?
> 
> Thanks!
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
> 
> 

See the helpfile for png().

If you change the width and height of your output, you should rescale the
pointsize of plotted text accordingly.  For example: 

#Without rescaling pointsize for text
png("temp1.png",width=200,height=200)
plot(rnorm(100),rnorm(100),main="A title of some sort")
dev.off()

#With pointsize for text rescaled
png("temp2.png",width=200,height=200, pointsize=6)
plot(rnorm(100),rnorm(100),main="A title of some sort")
dev.off()
-- 
View this message in context: http://www.nabble.com/Maintain-proportions-while-reducing-graphic-output-size-tp22909007p22913130.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list