Exports a highchart or ggplot figure produced by hd_make() to a
file. The output format is inferred from the file extension unless type
is supplied explicitly.
Usage
hd_save(
fig,
file,
type = "auto",
width = 8,
height = 5,
dpi = 300,
selfcontained = TRUE,
...
)Arguments
- fig
A
highchartorggplotobject (output ofhd_make()).- file
Character. Output path including extension.
- type
"auto"(infer from extension) or an explicit format string. Default:"auto".- width
Numeric. Width in inches (ggplot2). Default:
8.- height
Numeric. Height in inches (ggplot2). Default:
5.- dpi
Numeric. Raster resolution for ggplot2. Default:
300.- selfcontained
Logical. Embed all JS/CSS in the HTML file. Default:
TRUE.- ...
Passed to
ggplot2::ggsave()for ggplot2 figures.
Details
| Backend | Supported formats |
| highcharter | html, json |
| ggplot2 | png, svg, pdf, jpeg, jpg, |
tiff, bmp, eps |
To export a highcharter figure as an image, either save as html and
screenshot in a browser, or re-render with backend = "ggplot2" in
hd_make() and save as png.
