device_dimensions: Get requested output dimensions

View source: R/device_dimensions.R

device_dimensionsR Documentation

Get requested output dimensions

Description

Get the dimensions to pass to a graphics device (or related, such as ggplot2::ggsave()) for a graphic. The output proportions are determined by the default text size, the height in lines of text, and the aspect ratio.

Usage

device_dimensions(default_text, height, aspect_ratio)

Arguments

default_text

Default text size in points (1/72 of an inch)

height

The desired height of the graphic, in lines of text

aspect_ratio

The desired aspect ratio of the output graphic, as width / height

Value

Two-element list containing the height and width in inches

Examples

# A graphic at 16:9 and 35 lines of text tall
device_dimensions(
  default_text = 11,
  height = 35,
  aspect_ratio = 16/9
)

charlie-gallagher/ggunit documentation built on April 5, 2022, 4:29 a.m.