很多選項。你可以做
library(GGally)
ggparcoord(aggregate(mtcars, list(as.factor(cutree(hclust(dist(mtcars)), k = 4))), mean), columns=-1, groupColumn=1)
或
library(parcoords)
parcoords(
aggregate(mtcars, list(cutree(hclust(dist(mtcars)), k = 4)), mean),
color = list(colorScale = htmlwidgets::JS('d3.scale.category10()'), colorBy = "Group.1")
)
parcoords(
transform(mtcars, cluster = cutree(hclust(dist(mtcars)), k = 4)),
color = list(colorScale = htmlwidgets::JS('d3.scale.category10()'), colorBy = "cluster")
)