-1
A
回答
0
我会尝试使用GGPLOT2和ggrepel包这一点。我借用代码从this question制作凸包。
set.seed(175)
library(ggplot2)
library(ggrepel) # Or first install.packages("ggrepel")
# Make the cluster
mtcars$cluster <- as.factor(kmeans(mtcars, 3)$cluster)
# Get the convex hull for the axes you want to plot
hull_df <- plyr::ddply(mtcars, "cluster", function(dta) {
hull <- chull(dta$mpg, dta$disp)
dta[c(hull, hull[1]), ]
})
ggplot(mtcars, aes(mpg, disp, color = cluster, fill = cluster)) +
geom_point() +
geom_polygon(data = hull_df, alpha = 0.5) +
geom_text_repel(aes(label = row.names(mtcars)))
+0
谢谢,您真的帮了我很多! 如果你知道任何参考资料来解释clusplot是如何工作的,我会非常感激,因为对于我所寻找的,他是唯一一个可以绘制两个以上参数的集群,或者它只使用2个最重要的参数,运行像选择变量的东西? PCA?! – user2905427
0
下面是一些例子如何与DBSCAN做到这一点:
library(dbscan)
set.seed(2)
n <- 400
x <- cbind(
x = runif(4, 0, 1) + rnorm(n, sd=0.1),
y = runif(4, 0, 1) + rnorm(n, sd=0.1),
z = runif(4, 0, 1) + rnorm(n, sd=0.1)
)
cl <- rep(1:4, time = 100)
### show some points (first 10) inside the hulls with text
hullplot(x, cl, main = "True clusters", pch = NA)
points(x[1:10,])
text(x[1:10,], labels = paste("Obs.", 1:10), pos = 3)
### look at dimensions x and z
hullplot(x[, c("x", "z")], cl, main = "True clusters")
### use a PCA projection
hullplot(prcomp(x)$x, cl, main = "True clusters")
你可以看一下包wordcloud更好字布局。请参阅here.
相关问题
- 1. 按名称查找对象
- 2. 聚簇索引
- 3. mysql中的聚簇表查询
- 4. 非主键列上的聚簇索引或非聚簇索引?
- 5. 名称空间对象的名称
- 6. 传递匿名对象来查看
- 7. 查看名称消失
- 8. 从对象名称
- 9. 从非聚簇更改主键聚集
- 10. 对象的属性名称
- 11. 获取对象的名称
- 12. acstionscript 3循环对象名称迭代对象名称
- 13. 将对象名称空间和名称转换为对象
- 14. 了解聚簇索引
- 15. 插入聚簇索引表
- 16. 改变聚簇索引列
- 17. 按名称查找MVC模板查看
- 18. 按名称查找对象,使用JPA编辑对象
- 19. 包含vs的非聚簇索引与几乎相同的非聚簇索引无关;多个查询范围
- 20. SQL Server中唯一标识符列上的聚簇/非聚簇索引
- 21. 模型对象比。查看对象
- 22. C#获取对象对的名称
- 23. 混淆了聚簇索引和非聚簇索引。包含5个疑问
- 24. SQL Server性能:非聚簇索引+ INCLUDE列与聚簇索引 - 等效吗?
- 25. 尽管有聚簇索引,SQL Server仍在使用非聚簇索引
- 26. C# - 获取对象名称?
- 27. 粘贴为对象名称
- 28. Awesomium - 返回对象名称
- 29. jquery:获取对象名称?
- 30. RestKit PUT带对象名称
请添加创建剧情的代码 – rawr