geom_striplab | R Documentation |
annotate associated taxa (from taxa1 to taxa2, can be Monophyletic, Polyphyletic or Paraphyletc Taxa) with bar and (optional) text label or image
geom_striplab(
taxa1 = NULL,
taxa2 = NULL,
label = NULL,
data = NULL,
mapping = NULL,
geom = "text",
parse = FALSE,
...
)
taxa1 |
can be label or node number |
taxa2 |
can be label or node number |
label |
character, character to be showed, when data and mapping is NULL, it is required. |
data |
data.frame, the data to be displayed in the annotation, default is NULL. |
mapping |
Set of aesthetic mappings, default is NULL. The detail see the following explanation. |
geom |
character, one of 'text', 'label', 'shadowtext', 'image' and 'phylopic', default is 'text', and the parameter see the Aesthetics For Specified Geom. |
parse |
logical, whether parse label to emoji font, default is FALSE. |
... |
additional parameters, see also following section. additional parameters can refer the following parameters. ##'
The parameters also can be set in mapping, when data is provided. Note: the barsize, barcolour, fontsize, textcolour, imagesize and imagecolor should not be set in mapping (aesthetics). When the color and size are not be set in mapping, user can modify them to adjust the attributes of specified geom. |
geom_striplab()
understands the following aesthetics for geom="text"(required
aesthetics are in bold):
taxa1
selected tip label or tip node, it is required.
taxa2
selected another tip label or tip node, it is required.
label
labels to be shown, it is required.
colour
the colour of text, default is "black".
size
the size of text, default is 3.88.
angle
the angle of text, default is 0.
hjust
A numeric vector specifying horizontal justification, default is 0.
vjust
A numeric vector specifying vertical justification, default is 0.5.
alpha
the transparency of text, default is NA.
family
the family of text, default is 'sans'.
fontface
the font face of text, default is 1 (plain), others are
2 (bold), 3 (italic), 4 (bold.italic).
lineheight
The height of a line as a multiple of the size of text, default is 1.2 .
when the colour, size are not be set in mapping, and user want to modify the colour of text, they should use textcolour, fontsize to avoid the confusion with bar layer annotation.
geom_striplab()
understands the following aesthethics for geom="label" (required
aesthetics are in bold):
taxa1
selected node to hight light, it is required.
taxa2
selected another tip label or tip node, it is required.
label
labels to be shown, it is required.
colour
the colour of text, default is "black".
fill
the background colour of the label, default is "white".
size
the size of text, default is 3.88.
angle
the angle of text, default is 0.
hjust
A numeric vector specifying horizontal justification, default is 0.
vjust
A numeric vector specifying vertical justification, default is 0.5.
alpha
the transparency of text, default is NA.
family
the family of text, default is 'sans'.
fontface
the font face of text, default is 1 (plain), others are
2 (bold), 3 (italic), 4 (bold.italic).
lineheight
The height of a line as a multiple of the size of text, default is 1.2 .
when the colour, size are not be set in mapping, and user want to modify the colour of text, they should use textcolour, fontsize to avoid the confusion with bar layer annotation.
geom_striplab()
understands the following aesthethics for geom="shadowtext" (required
aesthetics are in bold):
taxa1
selected node to hight light, it is required.
taxa2
selected another tip label or tip node, it is required.
label
labels to be shown, it is required.
colour
the colour of text, default is "black".
bg.colour
the background colour of text, default is 'black'.
bg.r
the width of background text, default is 0.1.
size
the size of text, default is 3.88.
angle
the angle of text, default is 0.
hjust
A numeric vector specifying horizontal justification, default is 0.
vjust
A numeric vector specifying vertical justification, default is 0.5.
alpha
the transparency of text, default is NA.
family
the family of text, default is 'sans'.
fontface
the font face of text, default is 1 (plain), others are
2 (bold), 3 (italic), 4 (bold.italic).
lineheight
The height of a line as a multiple of the size of text, default is 1.2 .
when the colour, size are not be set in mapping, and user want to modify the colour of text, they should use textcolour, fontsize to avoid the confusion with bar layer annotation.
geom_striplab()
understands the following aesthethics for geom="image" or geom="phylopic" (required
aesthetics are in bold):
taxa1
selected node to hight light, it is required.
taxa2
selected another tip label or tip node, it is required.
label
labels to be shown, it is required.
image
the image to be annotated, when geom="phylopic",
the uid of phylopic databases, it is required.
colour
the color of image, default is NULL.
size
the size of image, default is 0.05.
alpha
the alpha of image, default is 0.8.
when the colour, size are not be set in mapping, and user want to modify the colour of image, they should use imagecolour, imagesize to avoid the confusion with bar layer annotation.
set.seed(123)
tr <- rtree(10)
dt <- data.frame(ta1=c("t5", "t1"), ta2=c("t6", "t3"), group=c("A", "B"))
p <- ggtree(tr) + geom_tiplab()
p2 <- p +
geom_striplab(
data = dt,
mapping = aes(taxa1 = ta1, taxa2 = ta2,
label = group, color=group),
align = TRUE,
show.legend = FALSE
)
p2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.