Search code examples
rplotpng

What is the default value of res (resolution) in R's png function?


What is the default value of the res parameter in png() ?

It can be changed like so png(res = 200), but I'm not sure what it's default value is.

Oddly, it's not in the documentation produced when ?png is run

i.e.

res The nominal resolution in ppi which will be recorded in the bitmap file, if a positive integer. Also used for units other than the default, and to convert points to pixels.

And (also strangely) the function itself does't even appear to be listed among those in the grDevices documentation


Solution

  • The default is 72ppi as stated in:

    res
    The nominal resolution in ppi which will be recorded in the bitmap file, if a positive integer. Also used for units other than the default. If not specified, taken as 72 ppi to set the size of text and line widths.

    Note however:

    By default no resolution is recorded in the file (except for BMP). Viewers will often assume a nominal resolution of 72 ppi when none is recorded. As resolutions in PNG files are recorded in pixels/metre, the reported ppi value will be changed slightly.