Run a plotting function and save the output as a PNGSource:
This function returns the name of the PNG file that it generates. In
essence, it calls
func must be a function that will generate a plot when used this
A function that generates a plot.
The name of the output file. Defaults to a temp file with extension
Width in pixels.
Height in pixels.
Resolution in pixels per inch. This value is passed to
grDevices::png(). Note that this affects the resolution of PNG rendering in R; it won't change the actual ppi of the browser.
Arguments to be passed through to
grDevices::png(). These can be used to set the width, height, background color, etc.
For output, it will try to use the following devices, in this order:
grDevices::png(). This is in order of quality of
output. Notably, plain
png output on Linux and Windows may not
antialias some point shapes, resulting in poor quality output.
In some cases,
Cairo() provides output that looks worse than
png(). To disable Cairo output for an app, use