mf_get_ratio function

Get map width and height values

Get map width and height values

This function is to be used to get width and height values for maps created in reports (*.Rmd, *.qmd).

It uses the width / height ratio of a spatial object bounding box to find a matching ratio for the map.

If width is specified, then height is deduced from the width / height ratio of x, figure margins and title size.

If height is specified, then width is deduced from the width / height ratio of x, figure margins and title size.

mf_get_ratio( x, width, height, res = 96, expandBB = rep(0, 4), theme = mf_theme() )

Arguments

  • x: object of class sf, sfc or SpatRaster
  • width: width of the figure (inches), use only one of width or height
  • height: height of the figure (inches), use only one of width or height
  • res: resolution
  • expandBB: fractional values to expand the bounding box with, in each direction (bottom, left, top, right)
  • theme: theme used for the map

Returns

Width and height are returned in inches.

Examples

mtq <- mf_get_mtq() mf_get_ratio(x = mtq, width = 5)
  • Maintainer: Timothée Giraud
  • License: GPL (>= 3)
  • Last published: 2024-10-22

Downloads (last 30 days):