Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

saveChart

Save Chart to External File


Description

Save selected chart to an external file.

Usage

saveChart(.type = "pdf", ..., dev = dev.cur())

Arguments

.type

type of export. See Details.

...

arguments to pass to device

dev

which device should be exported

Details

This function wraps the base R function pdf, postscript, png, jpeg, and bitmap. The .type argument must specify which device driver is desired.

The currently active device is used if dev is missing. The result is an exact copy (within the device limits) of the chart specified.

The name of the resultant file is derived from the name of the chart, with the appropriate extension appended. (from .type). Specifying the appropriate device file/filename will override this name.

The caller may specify any parameters that are valid for the device called. Internally, effort is made to match the dimensions of the device being used to create the output file. User supplied dimensions will override this internal calculation.

Value

A file in the current directory (default) matching the type of the output requested.

Note

As this uses do.call internally to create the new output device, any device that makes use of R conventions should be acceptable as a value for .type

Author(s)

Jeffrey A. Ryan

See Also

Examples

## Not run: 
getSymbols("AAPL")

chartSeries(AAPL)

require(TTR)
addBBands()

saveChart('pdf')
saveChart('pdf', width=13)

## End(Not run)

quantmod

Quantitative Financial Modelling Framework

v0.4.18
GPL-3
Authors
Jeffrey A. Ryan [aut, cph], Joshua M. Ulrich [cre, aut], Wouter Thielen [ctb], Paul Teetor [ctb], Steve Bronder [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.