Skip to contents

Saves a plot to a PNG file using the Cairo graphics device for consistent font rendering.

Usage

AS.save.png(g, path, width = 6, height = 5, units = "in", res = 300)

Arguments

g

A plot object to be saved.

path

File path of the output.

width

Width of the output image.

height

Height of the output image.

units

Units for width and height. Can be "cm", "in" (inches, the default), "mm", or "px" (pixels).

res

Nominal resolution in pixels per inch. Default = 300.

Value

The value returned by grDevices::dev.off().

Details

Requires Cairo support in the current R build. If Cairo is not available (capabilities("cairo") == FALSE), the function stops with an error.