stringSize: Size of a character string in current font

stringSizeR Documentation

Size of a character string in current font

Description

Calculates the approximate relative x and y spans of the input character string x in the current par("usr") coordinates. The srt, adj, and cex inputs are exactly those specified by the par function.

Usage

stringSize(x, srt=0, adj=0.5, cex=1)

Arguments

x

a character string.

adj

a numeric value on the interval [0,1] used to justify the text relative to its placement in a plot. Default: 0.5 (center aligned).

cex

the expansion value for the character string. Default: 1.

srt

a numeric value defining the amount of string rotation in degrees. Default: 0.

Value

a list of x- and y-vectors that can be used to estimate the width and height, respectively, of the input character string in the current par("usr") coordinates. Each vector contains a relative starting and ending value and the absolute difference between the two values represents the span in the corresponding direction.

Note

A graphics window will open up if one is not already opened.

See Also

par, autoKey, autoText, em.

Examples

stringSize("What's for dinner?", adj=0, srt=45, cex=1.5)

ifultools documentation built on July 14, 2022, 5:07 p.m.