geom_label2: geom_label2

View source: R/geom_label.R

geom_label2R Documentation

geom_label2

Description

geom_label2 support aes(subset) via setup_data

Usage

geom_label2(
  mapping = NULL,
  data = NULL,
  ...,
  stat = "identity",
  position = "identity",
  family = "sans",
  parse = FALSE,
  nudge_x = 0,
  nudge_y = 0,
  label.padding = unit(0.25, "lines"),
  label.r = unit(0.15, "lines"),
  label.size = 0.25,
  na.rm = TRUE,
  show.legend = NA,
  inherit.aes = TRUE
)

Arguments

mapping

Set of aesthetic mappings, defaults to NULL.

data

A layer specific dataset - only needed if you want to override the plot defaults.

...

other arguments passed on to 'layer'.

stat

Name of the stat to modify data.

position

The position adjustment to use for overlapping points on this layer.

family

"sans" by default, can be any supported font.

parse

if 'TRUE', the labels will be parsed as expressions, defaults to 'FALSE'.

nudge_x

adjust the horizontal position of the labels.

nudge_y

adjust the vertical position of the labels.

label.padding

Amount of padding around label, defaults to 'unit(0.25, "lines")'.

label.r

Use to set the radius of rounded corners of the label, defaults to 'unit(0.15, "lines")'.

label.size

Size of label border, in mm, defaults to 0.25.

na.rm

If "FALSE" (default), missing values are removed with a warning. If "TRUE", missing values are silently removed, logical.

show.legend

Whether to show legend, logical, defaults to "NA".

inherit.aes

Whether to inherit aesthetic mappings, logical, defaults to "TRUE".

Details

'geom_label2' is a modified version of geom_label, with subset aesthetic supported

Value

label layer

Author(s)

Guangchuang Yu

References

For more detailed demonstration of this function, please refer to chapter A.4.5 of Data Integration, Manipulation and Visualization of Phylogenetic Trees http://yulab-smu.top/treedata-book/index.html by Guangchuang Yu.

See Also

geom_label

Examples

library(ggtree)
set.seed(123)
tr<- rtree(15)
x <- ggtree(tr)
x + geom_label2(aes(label = node, subset = isTip == FALSE))

GuangchuangYu/ggtree documentation built on Oct. 31, 2024, 10:10 a.m.