Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

geom_tiplab

geom_tiplab


Description

add tip label layer

Usage

geom_tiplab(
  mapping = NULL,
  hjust = 0,
  align = FALSE,
  linetype = "dotted",
  linesize = 0.5,
  geom = "text",
  offset = 0,
  as_ylab = FALSE,
  ...
)

Arguments

mapping

aes mapping

hjust

horizontal adjustment

align

align tip lab or not, logical

linetype

linetype for adding line if align = TRUE

linesize

line size of line if align = TRUE

geom

one of 'text', 'label', 'shadowtext', 'image' and 'phylopic'

offset

tiplab offset, horizontal adjustment to nudge tip labels, default is 0.

as_ylab

display tip labels as y-axis label, only works for rectangular and dendrogram layouts

...

additional parameter

additional parameters can refer the following parameters.

The following parameters for geom="text".

  • size control the size of tip labels, default is 3.88.

  • colour control the colour of tip labels, default is "black".

  • angle control the angle of tip labels, 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 .

  • nudge_x horizontal adjustment to nudge labels, default is 0.

  • nudge_y vertical adjustment to nudge labels, default is 0.

  • check.overlap if TRUE, text that overlaps previous text in the same layer will not be plotted.

  • parse if TRUE, the labels will be parsed into expressions, if it is 'emoji', the labels will be parsed into emojifont.

The following parameters for geom="label".

  • size the size of tip labels, default is 3.88.

  • colour the colour of tip labels, default is "black".

  • fill the colour of rectangular box of labels, default is "white".

  • vjust numeric vector specifying vertical justification, default is 0.5.

  • alpha the transparency of labels, 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.

  • nudge_x horizontal adjustment to nudge labels, default is 0.

  • nudge_y vertical adjustment, default is 0.

  • check.overlap if TRUE, text that overlaps previous text in the same layer will not be plotted.

  • parse if TRUE, the labels will be parsed into expressions, if it is 'emoji', the labels will be parsed into emojifont.

  • label.padding Amount of padding around label, default is 'unit(0.25, "lines")'.

  • label.r Radius of rounded corners, default is 'unit(0.15, "lines")'.

  • label.size Size of label border, in mm, default is 0.25.

The following parameters for geom="shadowtext", some parameters are like to geom="text".

  • bg.colour the background colour of text, default is "black".

  • bg.r the width of background of text, default is 0.1 .

The following parameters for geom="image" or geom="phylopic".

  • image the image file path for geom='image', but when geom='phylopic', it should be the uid of phylopic databases.

  • size the image size, default is 0.05.

  • colour the color of image, default is NULL.

  • alpha the transparency of image, default is 0.8.

The following parameters for the line when align = TRUE.

  • colour the colour of line, default is 'black'.

  • alpha the transparency of line, default is NA.

  • arrow specification for arrow heads, as created by arrow(), default is NULL.

  • arrow.fill fill color to usse for the arrow head (if closed), default is 'NULL', meaning use 'colour' aesthetic.

Value

tip label layer

Author(s)

Guangchuang Yu

Examples

require(ape)
tr <- rtree(10)
ggtree(tr) + geom_tiplab()

ggtree

an R package for visualization of tree and annotation data

v2.4.2
Artistic-2.0
Authors
Guangchuang Yu [aut, cre, cph] (<https://orcid.org/0000-0002-6485-8781>), Tommy Tsan-Yuk Lam [aut, ths], Shuangbin Xu [aut] (<https://orcid.org/0000-0003-3513-5362>), Yonghe Xia [ctb], Justin Silverman [ctb], Bradley Jones [ctb], Watal M. Iwasaki [ctb], Ruizhu Huang [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.