# strwidth

0th

Percentile

##### Plotting Dimensions of Character Strings and Math Expressions

These functions compute the width or height, respectively, of the given strings or mathematical expressions s[i] on the current plotting device in user coordinates, inches or as fraction of the figure width par("fin").

Keywords
dplot, character
##### Usage
strwidth(s, units = "user", cex = NULL, font = NULL, vfont = NULL, ...) strheight(s, units = "user", cex = NULL, font = NULL, vfont = NULL, ...)
##### Arguments
s
a character or expression vector whose dimensions are to be determined. Other objects are coerced by as.graphicsAnnot.
units
character indicating in which units s is measured; should be one of "user", "inches", "figure"; partial matching is performed.
cex
numeric character expansion factor; multiplied by par("cex") yields the final character size; the default NULL is equivalent to 1.
font, vfont, ...
additional information about the font, possibly including the graphics parameter "family": see text.
##### Details

Note that the ‘height’ of a string is determined only by the number of linefeeds ("\n") it contains: it is the (number of linefeeds - 1) times the line spacing plus the height of "M" in the selected font. For an expression it is the height of the bounding box as computed by plotmath. Thus in both cases it is an estimate of how far above the final baseline the typeset object extends. (It may also extend below the baseline.) The inter-line spacing is controlled by cex, par("lheight") and the ‘point size’ (but not the actual font in use).

Measurements in "user" units (the default) are only available after plot.new has been called -- otherwise an error is thrown.

##### Value

Numeric vector with the same length as s, giving the estimate of width or height for each s[i]. NA strings are given width and height 0 (as they are not plotted).