pf.plot: Label and visualize phylofactors

View source: R/pf.plot.R

pf.plotR Documentation

Label and visualize phylofactors

Description

Label and visualize phylofactors

Usage

pf.plot(PF, tree = NULL, Data = NULL, bg = "white", cex = 2,
  factors = 1, compare = F, ...)

Arguments

PF

PhyloFactor object

tree

Phylogeny used in generating PhyloFactor object. Default will scan PF for a tree.

Data

Data used to generate PhyloFactor object. If Null, default will plot the phylofactor prediction of the dataset.

bg

Background color for node labels, default 'white'

cex

Size of node labels, default 2.

factors

factors of phylofactor object to be labelled on tree and used in prediction.

compare

Whether or not to compare the Data with phylofactor prediction. If compare = TRUE, two phylo-heatmaps will be produced for direct comparison.

...

additional arguments for pf.heatmap

Value

phylo.heatmap labelling the tree with phylofactors and optionally comparing data to phylofactor predictions.

Examples

 ### Create Data ###
 set.seed(1)
tree <- unroot(rtree(7))
X <- as.factor(c(rep(0,5),rep(1,5)))
sigClades <- phangorn::Descendants(tree,c(9,12),type='tips')
Data <- matrix(rlnorm(70,meanlog = 8,sdlog = .5),nrow=7)
rownames(Data) <- tree$tip.label
colnames(Data) <- X
Data[sigClades[[1]],X==0] <- Data[sigClades[[1]],X==0]*8
Data[sigClades[[2]],X==1] <- Data[sigClades[[2]],X==1]*9
Data <- t(clo(t(Data)))
PF <- PhyloFactor(Data,tree,X,nfactors=2)
pf.plot(PF,factors=1)
pf.plot(PF,factors=c(1,2),Data=PF$Data,compare=TRUE)

reptalex/phylofactor documentation built on Feb. 28, 2024, 3:19 p.m.