ggsave

fun ggsave(plot: Figure, filename: String, scale: Number = 2, dpi: Number? = null, path: String? = null): String

Exports plot to a file. Supported formats: SVG, HTML, PNG, JPEG and TIFF. Note: in some configurations raster formats might not be supported.

The exported file is created in directory ${user.dir}/lets-plot-images if not specified otherwise (see the path parameter).

Examples

Return

Absolute pathname of created file.

Parameters

plot

Plot or GGBunch to export.

filename

The name of file. It mast end with file extention corresponding to one of the supported formats: svg, html (or htm), png, jpeg (or jpg) or tiff (or tif)

scale

Scaling factor (only for raster formats). Default: 2.0

dpi

Dot-per-Inch value to store in the exported file metadata (only for raster formats). Default: no metadata is stored.

path

Path to a directory to save image files in. Default: ${user.dir}/lets-plot-images