prefer_dimension: Preferred height and width of layers with texts

Description Usage Arguments Details Value Author(s) Examples

Description

The height and width of a layer which draws texts often involves with the number of line breaks ('\n') in the texts. These two functions give the preferred height and width of a layer as a rule of thumb.

Usage

1
2
3

Arguments

text

the character vector to be drawn in the layer

horizontal

logical: the text is drawn horizontally (TRUE) or vertically (FALSE)

Details

Usually the height and width of the title layer and x- and y-axis layers need to be adjusted dynamically.

Value

The height or width (numeric).

Author(s)

Yihui Xie <http://yihui.name>

Examples

1
2
3
4
5
6
prefer_height("a label")
prefer_height("this is\na label")
prefer_width("abc")
prefer_width("a long long label")
prefer_width("line\nbreaks")  # 'breaks' dominates the width because it is wider
prefer_width("multiple\nvertical\nlines", horizontal = FALSE)

ggobi/cranvas documentation built on May 17, 2019, 3:10 a.m.