2

I know this is a little bit too much, but I am plotting a dendrogram plot in r, and here is my code:

dd <- dist(scale(full[,c(1,2,3,4)]),method="euclidean")
hc = hclust(dd,method="ward.D2")
dend <- color_branches(as.dendrogram(hc),6)

labels_colors(dend) <-
  rainbow_hcl(6)[sort_levels_values(
    as.numeric(classified[, 9])[order.dendrogram(dend)]
  )]
plot(dend,horiz=T)

and I got this plot: enter image description here Is there any way can do mirror symmetry to make it like this:(please ignore the difference in colour) enter image description here

Yiyun Ding
  • 33
  • 4
  • 1
    Which libraries are you using? For example, the `full` function in line 1 isn't from `base`. – Greg Mar 22 '21 at 20:56
  • https://stackoverflow.com/questions/3792803/is-it-possible-to-rotate-a-plot-in-r-base-graphics#32198964 shows a way to rotate base r plots ... doesn't do to bad in your example – user20650 Mar 22 '21 at 21:22

1 Answers1

3
plot_horiz.dendrogram(dend, side = TRUE)

should do the trick. See https://rdrr.io/cran/dendextend/f/vignettes/FAQ.Rmd

user12728748
  • 8,106
  • 2
  • 9
  • 14