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::ggsavedeviceDevice 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 thefilenameextension.scaleMultiplicative scaling factor.
limitsizeWhen
TRUE(the default),ggsave()will not save images larger than 50x50 inches, to prevent the common error of specifying dimensions in pixels.bgBackground colour. If
NULL, uses theplot.backgroundfill value from the plot theme.create.dirWhether to create new directories if a non-existing directory is specified in the
filenameorpath(TRUE) or return an error (FALSE, default). IfFALSEand 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")
}
