Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何删除簇图中的单个属性_R_Ggplot2_Cluster Analysis - Fatal编程技术网

R 如何删除簇图中的单个属性

R 如何删除簇图中的单个属性,r,ggplot2,cluster-analysis,R,Ggplot2,Cluster Analysis,我想要一个相当简单,出版质量集群图。我已经创建了情节,删除了标题、图例,调整了轴标题,并提供了脚本。但是,我还想删除两个集群中每个集群的示例ID中的所有行标签“属性”,例如CLR45、HTR132。这可能吗 您可以使用labelsize=0,如下代码所示 library("factoextra") # Data preparation data("iris") head(iris) # Remove species column (5) and scal

我想要一个相当简单,出版质量集群图。我已经创建了情节,删除了标题、图例,调整了轴标题,并提供了脚本。但是,我还想删除两个集群中每个集群的示例ID中的所有行标签“属性”,例如CLR45、HTR132。这可能吗


您可以使用
labelsize=0
,如下代码所示

library("factoextra")

# Data preparation
data("iris")
head(iris)
# Remove species column (5) and scale the data
iris.scaled <- scale(iris[, -5])

# K-means clustering
km.res <- kmeans(iris.scaled, 3, nstart = 25)

# Visualize kmeans clustering
fviz_cluster(km.res, iris[, -5], labelsize = 0) + 
  theme(legend.position = "none") + labs(title = "") +  
  theme(axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm")),
  axis.title.y = element_text(margin = unit(c(0, 3, 0, 0), "mm")))
要删除群集中心,请使用
show.clust.cent=F

fviz_cluster(km.res, iris[, -5], geom = NULL, labelsize = 0, show.clust.cent = F) + 
  theme(legend.position = "none") + labs(title = "") +  
  theme(axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm")),
  axis.title.y = element_text(margin = unit(c(0, 3, 0, 0), "mm")))

谢谢。是否有可能删除所有的小几何形状,以及使集群的只是一个纯色。我打算包括一个我的每个位置的比例表,这些位置属于集群:viz_集群(k2,data=Chem),labelsize=0)+主题(legend.position=“none”)+实验室(title=”“)+主题(axis.title.x=元素_文本(margin=unit(c(3,0,0,0),“mm”)、axis.title.y=元素_文本(margin=unit)(c(0,3,0,0),“mm”)))我做得不对是因为我遇到了一个错误:错误:意外”,“在”fviz_cluster(k2,data=Chem)“中,你能以
dput(Chem)
的形式提供你的数据吗?这起作用了:fviz_cluster(k2,data=Chem,geom=NULL,labelsize=0)+主题(legend.position=“none”)+实验室(title=“”)+主题(axis.title.x=element\u text(margin=unit)(c)(3,0,0,0),“mm”)),轴.title.y=元素\文本(边距=单位(c(0,3,0,0),“mm”))
fviz_cluster(km.res, iris[, -5], geom = NULL, labelsize = 0) + 
  theme(legend.position = "none") + labs(title = "") +  
  theme(axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm")),
  axis.title.y = element_text(margin = unit(c(0, 3, 0, 0), "mm")))
fviz_cluster(km.res, iris[, -5], geom = NULL, labelsize = 0, show.clust.cent = F) + 
  theme(legend.position = "none") + labs(title = "") +  
  theme(axis.title.x = element_text(margin = unit(c(3, 0, 0, 0), "mm")),
  axis.title.y = element_text(margin = unit(c(0, 3, 0, 0), "mm")))