3 \title{Mixed Font Labels for Plotting}
5 This function helps to format labels with bits of text in different
6 font shapes (italics, bold, or bolditalics) and different
7 separators. The output is intended to be used for plotting.
10 mixedFontLabel(..., sep = " ", italic = NULL, bold = NULL,
12 always.upright = c("sp.", "spp.", "ssp."))
15 \item{\dots}{vectors of mode character to be formatted. They may be
16 of different lengths in which case the shortest ones are
18 \item{sep}{a vector of mode character giving the separators to be
19 printed between the elements in \code{\dots}.}
20 \item{italic}{a vector of integers specifying the elements in
21 \code{\dots} to be printed in italics.}
22 \item{bold}{id. in boldface.}
23 \item{parenthesis}{id. within parentheses.}
24 \item{always.upright}{of vector of mode character giving the strings
25 to not print in italics. Use \code{always.upright = ""} to cancel
29 The idea is to have different bits of text in different vectors that
30 are put together to make a vector of R expressions. This vector is
31 interpreted by graphical functions to format the text. A simple use
32 may be \code{mixedFontLabel(genus, species), italic = 1:2}, but it is
33 more interesting when mixing fonts (see examples).
35 To have an element in bolditalics, its number must given in both
36 \code{italic} and \code{bold}.
38 The vector returned by this function may be assigned as the
39 \code{tip.label} element of a tree of class \code{"phylo"}, or even as
40 its \code{node.label} element.
43 A vector of mode expression.
45 \author{Emmanuel Paradis}
47 \code{\link{makeLabel}}, \code{\link{makeNodeLabel}}
50 tr <- read.tree(text = "((a,(b,c)),d);")
51 genus <- c("Gorilla", "Pan", "Homo", "Pongo")
52 species <- c("gorilla", "spp.", "sapiens", "pygmaeus")
53 geo <- c("Africa", "Africa", "World", "Asia")
54 tr$tip.label <- mixedFontLabel(genus, species, geo, italic = 1:2,
56 layout(matrix(c(1, 2), 2))
58 tr$tip.label <- mixedFontLabel(genus, species, geo, sep = c(" ", " | "),
59 italic = 1:2, bold = 3)