Learn R Programming

ch (version 0.1.0.2)

ggpng: Create a picture with a transparent background.

Description

Use the ImageMagick command line to convert the PDF saved by ggplot2 to PNG format with a transparent background and to set the resolution.

Usage

ggpng(x, dpi = 600, ...)

ggPNG(x, p, dpi = 600, ...)

Arguments

x

A file name that does not have a suffix.

dpi

The default dpi is 600. You can enhance the dpi value to produce a higher resolution PNG file.

...

see :ggsave

p

ggplot2 object

Value

You will get a PNG file with the result drawn by ggplot2.

Details

You need to install ImageMagick! Please check if the ImageMagick is added to the environment variable.

this ggplot2 object will automatically add a theme with a transparent background.