Description Usage Arguments See Also Examples
Extract data frame from tree object for plotting using ggplot
1 | cluster_segments.tree(model, ...)
|
model |
object of class "tree", e.g. the output of tree() |
... |
ignored |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | require(tree)
require(ggplot2)
data(cpus, package="MASS")
cpus.ltr <- tree(log10(perf) ~ syct+mmin+mmax+cach+chmin+chmax, cpus)
tree_data <- cluster_data(cpus.ltr)
ggplot() +
geom_segment(data=tree_data$segments,
aes(x=x, y=y, xend=xend, yend=yend, size=n),
colour="blue", alpha=0.5) +
scale_size("n", to=c(0, 3)) +
geom_text(data=tree_data$labels,
aes(x=x, y=y, label=label), vjust=-0.5, size=4) +
geom_text(data=tree_data$leaf_labels,
aes(x=x, y=y, label=label), vjust=0.5, size=3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.