Save function
Usage
ggeo_save(
plot,
filename,
width = geotools::gtl_options("plot_standard_width"),
height = geotools::gtl_options("plot_standard_height"),
dpi = 72,
units = "cm",
...
)
Arguments
- plot
The ggplot2 object to save (should be piped in ;)
- filename
Path for filename (with extension!)
- width
The plot width. Defaults to keynote width (
geotools::gtl_options("plot_standard_width")
). For full slide width usegeotools::gtl_options("plot_full_width")
.- height
The plot height. Defaults to keynote height (
geotools::gtl_options("plot_standard_height")
). For full slide height usegeotools::gtl_options("plot_full_height")
.- dpi
The DPI. Default is 72.
- units
Units. Default is cm.
- ...
Arguments passed on to
ggplot2::ggsave
device
Device to use. Can either be a device function (e.g. png), or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only). If
NULL
(default), the device is guessed based on thefilename
extension.scale
Multiplicative scaling factor.
limitsize
When
TRUE
(the default),ggsave()
will not save images larger than 50x50 inches, to prevent the common error of specifying dimensions in pixels.bg
Background colour. If
NULL
, uses theplot.background
fill value from the plot theme.create.dir
Whether to create new directories if a non-existing directory is specified in the
filename
orpath
(TRUE
) or return an error (FALSE
, default). IfFALSE
and run in an interactive session, a prompt will appear asking to create a new directory when necessary.
Examples
if (FALSE) { # interactive()
cars |>
ggplot2::ggplot(ggplot2::aes(x = speed, y = dist)) +
ggplot2::geom_point() -> simple_plot
ggeo_save(simple_plot, "simple_plot.png")
}