text_dimensions: Get default text size for a graphic

View source: R/text_dimensions.R

text_dimensionsR Documentation

Get default text size for a graphic

Description

Given the size of a graphic and the desired height in lines, returns the text size in points to use as the default text size.

Usage

text_dimensions(height, lines, units = "in", round = TRUE)

Arguments

height

Height of the graphic.

lines

Desired number of lines tall the graphic will be.

units

Units in which height and width are given. Only "in", "cm", and "mm" are currently supported.

round

Logical, whether to round the output to the nearest point. Defaults to TRUE.

Value

Size of font in points, rounded to the nearest integer

Examples

# Find the appropriate default text size for a graphic that fills a whole
# 8.5x11 sheet of paper.
text_dimensions(height = 8.5,
                lines = 45,
                units = "in")

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