plot-api / jetbrains.letsPlot.export / ggsave

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).

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). By default: no metadata is stored.

path - Path to a directory to save image files in. By default it is ${user.dir}/lets-plot-images

Return
Absolute pathname of created file.