【问题标题】:Delete Scale for Height in dendrogram visualisation在树状图可视化中删除高度比例
【发布时间】:2016-08-09 19:09:10
【问题描述】:

我可以使用

创建树状图
x<-1:100
dim(x)<-c(10,10)
set.seed(1)
groups<-c("red","red", "red", "red", "blue", "blue", "blue","blue", "red", "blue")
x.clust<-as.dendrogram(hclust(dist(x)))

x.clust.dend <- x.clust
labels_colors(x.clust.dend) <- groups
x.clust.dend <- assign_values_to_leaves_edgePar(x.clust.dend, value = groups, edgePar = "col") # add the colors.
x.clust.dend <- assign_values_to_leaves_edgePar(x.clust.dend, value = 3, edgePar = "lwd") # make the lines thick
plot(x.clust.dend) 

但是我想删除左侧的高度信息比例如下图所示。 我的猜测是它应该非常微不足道,但我无法找到一种方法来做到这一点。我不想要的一种解决方案是使用ggplot2,如下所示:

ggplot(as.ggdend(dend2))

这是因为我会丢失一些格式,例如color_bars()

【问题讨论】:

  • 试试这个:plot(x.clust.dend, yaxt="n")

标签: r visualization hierarchical-clustering dendrogram dendextend


【解决方案1】:

你可以设置yaxt = "n"

plot(x.clust.dend, yaxt = "n") 

您可以使用

添加另一个轴
axis(side = 2, labels = FALSE)

【讨论】:

    【解决方案2】:

    图形参数“axes = FALSE”可用于删除plot.dendogram命令的距离度量:

    plot(x.clust.dend, axes=F)
    

    这将产生以下没有距离轴的树状图:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-25
      • 1970-01-01
      • 1970-01-01
      • 2012-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多