Tag: ggdendro

用ggplot2重现格型树状图

这是可能重现与ggplot2这个格子图吗? library(latticeExtra) data(mtcars) x <- t(as.matrix(scale(mtcars))) dd.row <- as.dendrogram(hclust(dist(x))) row.ord <- order.dendrogram(dd.row) dd.col <- as.dendrogram(hclust(dist(t(x)))) col.ord <- order.dendrogram(dd.col) library(lattice) levelplot(x[row.ord, col.ord], aspect = "fill", scales = list(x = list(rot = 90)), colorkey = list(space = "left"), legend = list(right = list(fun = dendrogramGrob, args = list(x = dd.col, ord = col.ord, side = "right", size […]