geom_hilight {ggtree}R Documentation

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), 'gradient' (gradient color), 'roundrect' (round rectangular layer).

...

additional parameters, see also the below and Aesthetics section.

  • align control the align direction of the edge of high light rectangular. Options is 'none' (default), 'left', 'right', 'both'. This argument only work when the 'geom_hilight' is plotting using geom_hilight(mapping=aes(...)).

  • gradient.direction character, the direction of gradient color, default is 'rt' meaning the locations of gradient color is from root to tip, options are 'rt' and 'tr'.

  • gradient.length.out integer, desired length of the sequence of gradient color, default is 2.

  • roundrect.r numeric, the radius of the rounded corners, when roundrect=TRUE, default is 0.05.

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):

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

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
p3 <- p + geom_hilight(data=dat, mapping=aes(node=id, fill=type), align="left")
p4 <- p + geom_hilight(data=dat, mapping=aes(node=id, fill=type), align="right")
p5 <- p + geom_hilight(data=dat, mapping=aes(node=id, fill=type), align="both")
# display the high light layer with gradiental color rectangular.
p6 <- p + geom_hilight(data=dat, mapping=aes(node=id, fill=type), type = "gradient", alpha=0.68)
p7 <- p + geom_hilight(data=dat, mapping=aes(node=id, fill=type), type = "gradient", gradient.direction="tr", alpha=0.68)
# display the high light layer with round rectangular.
p8 <- p + geom_hilight(data=dat, mapping=aes(node=id, fill=type), type = "roundrect", alpha=0.68)
p2/ p3/ p4/ p5 / p6/ p7/ p8

[Package ggtree version 3.2.0 Index]