inset: geom_inset

View source: R/inset.R

geom_insetR Documentation

geom_inset

Description

gemo_inset can add subplots to tree by accepting a list of ggplot objects that are ancestral stats or data associated with selected nodes in the tree. These ggplot objects can be any kind of charts or hybrid of of these charts.

add subplots as insets in a tree

Usage

geom_inset(
  insets,
  width = 0.1,
  height = 0.1,
  hjust = 0,
  vjust = 0,
  x = "node",
  reverse_x = FALSE,
  reverse_y = FALSE
)

inset(
  tree_view,
  insets,
  width,
  height,
  hjust = 0,
  vjust = 0,
  x = "node",
  reverse_x = FALSE,
  reverse_y = FALSE
)

Arguments

insets

a list of ggplot objects, named by node number

width

width of the inset, relative to the range of x-axis, defaults to .1

height

height of the inset, relative to the range of y-axis, defaults to .1

hjust

adjust the horizontal position of the charts, charts will go left if hjust > 0

vjust

adjust the vertical position of the charts, charts will go down if vjust > 0

x

the position where users want to place the charts, one of 'node' (default) and 'branch'

reverse_x

whether to reverse x axis of the charts by 'ggplot2::scale_x_reverse', defaults to 'FALSE'

reverse_y

whether to reverse y axis of the charts by 'ggplot2::scale_y_reverse', defaults to 'FALSE'

tree_view

tree view

Details

Users can also use

Value

inset layer

tree view with insets

Author(s)

Guangchuang Yu

References

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


GuangchuangYu/ggtree documentation built on April 12, 2024, 5:20 a.m.