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

geom-hilight

geom_hilight


Description

layer of hilight clade

Usage

geom_hilight(data = NULL, mapping = NULL, node = NULL, type = "auto", ...)

geom_highlight(data = NULL, mapping = NULL, node = NULL, type = "auto", ...)

Arguments

data

data.frame, The data to be displayed in this layer, default is NULL.

mapping

Set of aesthetic mappings, default is NULL.

node

selected node to hilight, when data and mapping is NULL, it is required.

type

the type of layer, default is auto, meaning rectangular, circular, slanted, fan, inward_circular, radial, equal_angle, ape layout tree will use rectangular layer, unrooted and daylight layout tree use will use encircle layer. You can specify this parameter to rect (rectangular layer) or encircle (encircle layer).

...

additional parameters, see also Aesthetics section.

Details

geom_hilight supports data.frame as input. And aesthetics of layer can be mapped. you can see the Aesthetics section to set parameters.

Value

a list object.

Aesthetics

geom_hilight() understands the following aesthetics for rectangular layer (required aesthetics are in bold):

  • node selected node to hight light, it is required.

  • colour the colour of margin, default is NA.

  • fill the colour of fill, default is 'steelblue'.

  • alpha the transparency of fill, default is 0.5.

  • extend extend xmax of the rectangle, default is 0.

  • extendto specify a value, meaning the rectangle extend to, default is NULL.

  • linetype the line type of margin, default is 1.

  • size the width of line of margin, default is 0.5.

geom_hilight() understands the following aesthethics for encircle layer (required aesthetics are in bold):

  • node selected node to hight light, it is required.

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

  • fill the colour of fill, default is 'steelblue'.

  • alpha the transparency of fill, default is 0.5.

  • expand expands the xspline clade region, default is 0.

  • spread control the size, when only one point.

  • size the width of line of margin, default is 0.5.

  • linetype the line type of margin, default is 1.

  • s_shape the shape of the spline relative to the control points, default is 0.5.

  • s_open whether the spline is a line or a closed shape, default is FALSE.

Author(s)

Guangchuang Yu and Shuangbin Xu

Examples

library(ggplot2)
set.seed(102)
tree <- rtree(60)
p <- ggtree(tree)
p1 <- p + geom_hilight(node=62) + geom_hilight(node=88, fill="red")
p1
dat <- data.frame(id=c(62, 88), type=c("A", "B"))
p2 <- p + geom_hilight(data=dat, mapping=aes(node=id, fill=type))
p2

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.