Here are various ways of creating a png file. The dpi seems to be treated inconsistently.

> quartz(width=7, height=7); plot(1:11); dev.copy2pdf()

produces a plot of 7x7 in, 2100x2100 pixels, 300 ppi. So dpi defaults to 300 - fair enough ... But

> quartz(width=7, height=7, dpi=72); plot(1:11); dev.copy2pdf()

also produces a plot of 7x7 in, 2100x2100 pixels, 300 ppi. So dpi=72 is overruled with dpi=300.

Writing directly to file produces the opposite effect:

> quartz(width=7, height=7, type='png', dpi=300); plot(1:11); dev.off()

or

> png(width=7, height=7, units='in', res=300, type='quartz')
> plot(1:11); dev.off()

both produce plots of 7x7 in, 2100x2100 pixels, 72 ppi. So here dpi=300 is overruled with dpi=72.

The plot resolution is correct throughout, but writing directly to file the dpi is wrong. Is there a way to force the file to have dpi=300?

I'm on R 2.11.1 GUI 1.34 Leopard build 32-bit (5589).

Thanks,
Tim

--
tim.c...@ich.ucl.ac.uk Phone +44(0)20 7905 2666 Fax +44(0)20 7905 2381
MRC Centre of Epidemiology for Child Health,
UCL Institute of Child Health, London WC1N 1EH, UK

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to