plot_tree: Plot MRtree results as hierarchical cluster tree.

plot_treeR Documentation

Plot MRtree results as hierarchical cluster tree.

Description

Plot MRtree results as a dendrogram. If reference labels are provided, a pie chart is shown at each tree node, giving the label proprotions for respective cluster.

Usage

plot_tree(
  labelmat,
  ref.labels = NULL,
  show.ref.labels = TRUE,
  label.order = NULL,
  node.size = 0.2,
  cols = NULL,
  plot.piechart = TRUE,
  tip.labels = NULL,
  tip.label.dist = 4,
  show.branch.labels = FALSE,
  branch.label.dist = 10,
  flip.branch = NULL,
  legend.title = "",
  bottom.margin = 25
)

Arguments

labelmat

a n by m label matrix, provided by the ouput of mrtree function, labelmat.mrtree

ref.labels

a factor or characteristic vector specifying the reference labels of n data points

show.ref.labels

boolean, whether to show the labels of major type at tree nodes and tips

label.order

a vector specifying the order of labels for default colors

node.size

scalar, the size of the pie chart / node

cols

a vector of colors, one per each label. If not provided, use the default colors.

plot.piechart

boolean, whether to draw the pie chart for each tree node.

tip.labels

a vector of strings specifying the labels of tree leafs. The labels should align with the order of leaf in the plot.

tip.label.dist

vertical distance of the tip labels to the tree tips

show.branch.labels

boolean, whether to show the branch labels for convenience of flipping branches

branch.label.dist

vertical distance from branch node labels to the node

flip.branch

a list of vectors each of size 2, indicating the branch labels to flip. Each time two branches are flipped.

legend.title

string as legend title. Empty string by default.

bottom.margin

size of the bottom margin, need to be adjusted to show the full labels.

Examples

data("clust_example")
out = mrtree(clust_example$clusterings)
plot_tree(labelmat = out$labelmat.mrtree, ref.labels = clust_example$ref.labels, plot.piechart = TRUE)

pengminshi/MRtree documentation built on March 6, 2023, 4:20 p.m.