]> git.donarmstrong.com Git - ape.git/blob - man/mixedFontLabel.Rd
new mixedFontLabel() + bug fix in rTraitCont.c
[ape.git] / man / mixedFontLabel.Rd
1 \name{mixedFontLabel}
2 \alias{mixedFontLabel}
3 \title{Mixed Font Labels for Plotting}
4 \description{
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.
8 }
9 \usage{
10 mixedFontLabel(..., sep = " ", italic = NULL, bold = NULL,
11                parenthesis = NULL,
12                always.upright = c("sp.", "spp.", "ssp."))
13 }
14 \arguments{
15   \item{\dots}{vectors of mode character to be formatted. They may be
16     of different lengths in which case the shortest ones are
17     recycled.}
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
26     this option.}
27 }
28 \details{
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).
34
35   To have an element in bolditalics, its number must given in both
36   \code{italic} and \code{bold}.
37
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.
41 }
42 \value{
43   A vector of mode expression.
44 }
45 \author{Emmanuel Paradis}
46 \seealso{
47   \code{\link{makeLabel}},  \code{\link{makeNodeLabel}}
48 }
49 \examples{
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,
55   parenthesis = 3)
56 layout(matrix(c(1, 2), 2))
57 plot(tr)
58 tr$tip.label <- mixedFontLabel(genus, species, geo, sep = c(" ", " - "),
59   italic = 1:2, bold = 3)
60 plot(tr)
61 layout(1)
62 }
63 \keyword{manip}