save_ggmap: Save maps produced with ggplot with appropriate aspect ratio

View source: R/save_ggmap.R

save_ggmapR Documentation

Save maps produced with ggplot with appropriate aspect ratio

Description

Wrapper around ggsave() to save maps produced with ggplot with appropriate aspect ratio.

Usage

save_ggmap(filename, plot = last_plot(), width = NA, height = NA, ...)

Arguments

filename

File name to create on disk.

plot

Plot to save, defaults to last plot displayed.

width, height

Plot size in units ("in", "cm", or "mm"). If not supplied, uses the size of current graphics device.

...

Other arguments passed on to ggsave().

Examples

## Not run: 
world <- rnaturalearth::ne_countries(returnclass = "sf")

ggplot() +
  geom_sf(data = world) +
  coord_sf(expand = FALSE) +
  theme_void()

save_ggmap("world.svg", width = 8)

## End(Not run)

arnaudgallou/toolkit documentation built on Nov. 25, 2022, 5:42 p.m.