Skip to contents

Convert distance from scale to actual units based on named standard_scales

Usage

convert_dist_scale(
  dist = NULL,
  paper = NULL,
  orientation = NULL,
  scale = NULL,
  scale_unit = "in",
  actual_unit = NULL,
  scale_factor = NULL,
  dpi = 120
)

Arguments

dist

distance to convert. If paper is provided, paper width and height are used as dist.

paper

Paper, Default: 'letter'.

orientation

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

scale

Scale name

scale_unit

"mm" (converted to cm by dividing by 10), "cm", "px" (converted to inches by dividing by dpi), or "in".

actual_unit

any unit supported by convert_dist_units

scale_factor

factor for converting from scale_unit to actual_unit, e.g. if 1" = 1', the scale factor is 12. optional if scale if provided; defaults to NULL.

dpi

dots per square inch (used as conversion factor for "px" to "in")

Value

dist values converted from scale_unit to actual_unit based on scale_factor or information from standard_scales object. If paper is provided, return a data frame with converted distances as actual_width and actual_height