format_names_for_plotting: Format Names for Plotting

View source: R/utils.R

format_names_for_plottingR Documentation

Format Names for Plotting

Description

Wrap long names over multiple lines so that they will look better on plots.

Usage

format_names_for_plotting(chars, width = 40, truncate_at = 80)

Arguments

chars

a character vector (or a variable that can be converted to one)

width

Positive integer giving target line width (in number of characters). A width less than or equal to 1 will put each word on its own line.

truncate_at

max character length

Value

a reformatted character vector of the same length as the input.

Examples

chars <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer
  ac arcu semper erat porttitor egestas. Etiam sagittis, sapien at mattis."

format_names_for_plotting(chars)

romic documentation built on Sept. 21, 2023, 9:06 a.m.