R: Save Windows Plot to a File

savePlot {grDevices} | R Documentation

## Save Windows Plot to a File

### Description

Saves the current plot on a `windows` device to a file.

### Usage

    savePlot(filename = "Rplot",
             type = c("wmf", "emf", "png", "jpg", "jpeg", "bmp",
                      "tif", "tiff", "ps", "eps", "pdf"),
             device = dev.cur(),
             restoreConsole = TRUE)

### Arguments

`filename` | The filename under which to save the plot. Tilde-expansion (see `path.expand`) is supported.
`type` | The type of plot, Windows metafile, PNG, JPEG, BMP (Windows bitmap format), TIFF, PostScript or PDF.
`device` | A device number of a `windows` device, by default the current device.
`restoreConsole` | See the ‘Details’ section of `windows`. Do not use this in programming without first checking that the platform is Windows.

### Details

This is equivalent to selecting the ‘Save as’ menu item on the ‘File’ menu of a `windows` device.

If `filename` does not include a dot (‘.’), savePlot will add the file type as an extension; that is, the filename will be set to `paste(filename, type, sep = ".")`. If a dot is present in `filename`, the filename is assumed to include an extension and is used without change.

Using `filename` as `"clipboard"` or `""` with `type = "wmf"` will copy to the clipboard.

Types `"eps"` and `"ps"` are the same thing apart from the extension for the default `filename`. Similarly `"wmf"`/`"emf"`, `"jpeg"`/`"jpg"` and `"tiff"`/`"tif"`.

JPEG quality is 75%, and TIFF is saved without compression.

### Value

None, but a plot file will be created.

### Note

There is a similar function of the same name but fewer types for cairo-based `X11` devices on Unix-alikes, and without the `restoreConsole` argument.

### See Also

`recordPlot()` which is device independent. Further, `png`, `dev.print`

[Package grDevices version 4.0.5 Index]