[R] PNG resolution

Matthew Walker matthew.walker.1 at ulaval.ca
Tue Jan 26 18:05:04 CET 2010


Hi,

I expect that if I change only the resolution of an image, although the 
image would have more pixels, if viewed in the same physical size, the 
elements in the image would have the same physical size but with more 
detail.  However, when I use the "res" parameter of png() this is not 
what I see.  Would someone show me how I can just "increase the 
resolution" without changing the physical sizes of elements in my plot?

Maybe an example would help?  Below are three images.  I expect that if 
I print them out, let's say scaled to fit the page, then items such as 
the words "Title Text" would appear the same size.  Instead (for the 
last two) it appears that the same number of pixels are being used, thus 
the text size appears smaller.

What should I do to just increase the resolution?

png("72dpi.png", width=6+2/3, height=6+2/3, units="in", res=72)
plot(0,0, main="Title Text")
dev.off()

png("300dpi.png", width=6+2/3, height=6+2/3, units="in", res=300)
plot(0,0, main="Title Text")
dev.off()

png("600dpi.png", width=6+2/3, height=6+2/3, units="in", res=600)
plot(0,0, main="Title Text")
dev.off()

Thanks in advance,

Matthew Walker



More information about the R-help mailing list