Skip to contents

Get aspect ratio from string or based on specific paper and margins

Usage

get_asp(
  asp = NULL,
  paper = NULL,
  orientation = NULL,
  margin = NULL,
  unit = NULL,
  block_asp = FALSE,
  null.ok = TRUE
)

Arguments

asp

Aspect ratio of width to height as a numeric value (e.g. 0.33) or character (e.g. "1:3"). If numeric, get_asp() returns the same value without modification.

paper

Paper, Default: 'letter'.

orientation

Orientation "portrait", "landscape", or "square", Default: 'portrait'.

margin

A margin style supported by get_margin(), a numeric vector (length 1 or 4) passed to dist parameter of get_margin, or a margins object.

unit

Unit for margin distance, Default: 'in'.

block_asp

If TRUE, get aspect ratio of the map/plot area (not including the margins); defaults to FALSE.

Value

A numeric aspect ratio.

Examples

get_asp("1:2")
#> [1] 0.5

get_asp(11 / 17)
#> [1] 0.6470588

get_asp(paper = "letter")
#> [1] 0.7727273