Skip to contents

Make an automatic ggplot2 plot for a pf object

Usage

# S3 method for pf
autoplot(
  object,
  columns = NULL,
  layout = "circular",
  suppress_tiplabels = FALSE,
  suppress_tippoints = FALSE,
  edge_traits = FALSE,
  continuous = "colour",
  size = 1.4,
  outline_size = 1.4 * size,
  ...
)

Arguments

object

A pf object to plot

columns

Columns to plot along with the phylogeny. Can use bare column names or any other tidyselect syntax

layout

ggtree::ggtree() layout to use.

suppress_tiplabels

If TRUE, don't draw tip labels.

edge_traits

A logical indicating whether the continuous avriable refers to edge traits, where the edge is determines by the terminal node. (default is FALSE, which means the variable refers to a node trait).

continuous

continuous transition for selected aesthethic ('size' or 'color'('colour')). It should be one of 'color' (or 'colour'), 'size', 'all' and 'none', default is 'colour'.

...

Other arguments passed to or from other methods.

Value

A ggplot object.

Examples

autoplot(pf(rpfc(100)) %>% dplyr::mutate(trait = rnorm(dplyr::n())), trait,
layout = "rectangular")
#> Registered S3 methods overwritten by 'treeio':
#>   method              from    
#>   MRCA.phylo          tidytree
#>   MRCA.treedata       tidytree
#>   Nnode.treedata      tidytree
#>   Ntip.treedata       tidytree
#>   ancestor.phylo      tidytree
#>   ancestor.treedata   tidytree
#>   child.phylo         tidytree
#>   child.treedata      tidytree
#>   full_join.phylo     tidytree
#>   full_join.treedata  tidytree
#>   groupClade.phylo    tidytree
#>   groupClade.treedata tidytree
#>   groupOTU.phylo      tidytree
#>   groupOTU.treedata   tidytree
#>   inner_join.phylo    tidytree
#>   inner_join.treedata tidytree
#>   is.rooted.treedata  tidytree
#>   nodeid.phylo        tidytree
#>   nodeid.treedata     tidytree
#>   nodelab.phylo       tidytree
#>   nodelab.treedata    tidytree
#>   offspring.phylo     tidytree
#>   offspring.treedata  tidytree
#>   parent.phylo        tidytree
#>   parent.treedata     tidytree
#>   root.treedata       tidytree
#>   rootnode.phylo      tidytree
#>   sibling.phylo       tidytree