mf_export: Export a map

Description Usage Arguments Value Examples

View source: R/mf_export.R

Description

Export a map with the extent of a spatial object. The map is exported in PNG or SVG format. If only one of width or height is set, mf_export uses the width/height ratio of x bounding box to find a matching ratio for the export.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
mf_export(
  x,
  export = "png",
  filename = paste0("map.", export),
  width,
  height,
  res = 96,
  ...,
  expandBB = rep(0, 4),
  theme = "default"
)

Arguments

x

object of class sf, sfc or Raster

export

if set to "png" or "svg" a png or svg plot device is opened

filename

path to the exported file

width

width of the figure (pixels for png, inches for svg)

height

height of the figure (pixels for png, inches for svg)

res

resolution (for png)

...

further parameters for png or svg export

expandBB

fractional values to expand the bounding box with, in each direction (bottom, left, top, right)

theme

apply a theme from mf_theme

Value

No return value, a map is initiated.

Examples

1
2
3
4
5
mtq <- mf_get_mtq()
(filename <- tempfile(fileext = ".png"))
mf_export(mtq, filename = filename)
mf_map(mtq, add = TRUE)
dev.off()

mapsf documentation built on Sept. 24, 2021, 5:06 p.m.