Change labels Dendogram

Hello!

I would like to rename my labels to the corresponding names, so that I no longer get the names displayed but the corresponding names from 'name'.

This is my source code:

library(ggraph)
library(igraph)
library(tidyverse)
library(RColorBrewer)
set.seed(1)

name <- c("Druckmessung", "Temperaturmessung", "Beschleunigungsmessung", "Vibrationsmessung", "Hardwarekonfiguration", "verbaute physische Elemente", "verbaute physische Elemente", "Hardwarezustand (über Sensorik)", "Hardwarezustand (über Sensorik)", "Hardwarezustand (über Mensch/Protokoll)", "Hardwarezustand (über Mensch/Protokoll)", "Werkseinstellungen", "Versionsnummern", "Aktuelle Lizenzen", "Installierte Updates (Updateprotokoll)", "Installierte Updates (Updateprotokoll)", "Softwarestatus", "Softwarestatus", "Warnmeldung (über Mensch/Protokoll)","Warnmeldung (über Mensch/Protokoll)","Warnmeldung (über Mensch/Protokoll)", "Warnmeldung (aus Software)", "Warnmeldung (aus Software)", "Fehlermeldung", "Fehlermeldung", "Stillstandsmeldung", "Stillstandsmeldung", "Störung- und Stillstandszeit", "Produktionsmenge", "Gutmenge", "Anschlussmenge", "Auslastung", "Laufzeit", "Energieverbrauch", "Beschwerden", "Rezensionen/Bewertungen", "Rezensionen/Bewertungen", "Vorschläge", "Serviceprotokoll", "Serviceprotokoll", "Reparaturprotokoll", "Reparaturprotokoll", "Wartungsprotokoll", "Wartungsprotokoll", "Garantiefall", "Identität", "Biometrische Daten", "Persönliche Merkmale", "Persönliche Merkmale", "Ortsdaten", "Ortsdaten", "Aktivitätsdaten (über Benutzerschnittstellen)", "Aktivitätsdaten (über Benutzerschnittstellen)","Aktivitätsdaten (über Benutzerschnittstellen)")
array1 = c(0,0,0,1,0,0,0,0,0,1,0,0,1,0,1,0,0)
array2 = c(0,0,0,1,0,0,0,0,0,1,0,0,1,0,1,0,0)
array3 = c(0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0)
array4 = c(0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0)
array5 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1)
array6 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0)
array7 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1)
array8 = c(1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0)
array9 = c(0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0)
array10 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0)
array11 = c(0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0)
array12 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0)
array13 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0)
array14 = c(0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1)
array15 = c(1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0)
array16 = c(0,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,0)
array17 = c(1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0)
array18 = c(0,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,0)
array19 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0)
array20 = c(0,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0)
array21 = c(0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,0)
array22 = c(0,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,0)
array23 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array24 = c(0,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,0)
array25 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array26 = c(0,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,0)
array27 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array28 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array29 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array30 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array31 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array32 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array33 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array34 = c(0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0)
array35 = c(0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0)
array36 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0)
array37 = c(0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0)
array38 = c(0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0)
array39 = c(0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1)
array40 = c(0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0)
array41 = c(0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1)
array42 = c(0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0)
array43 = c(0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1)
array44 = c(0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0)
array45 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0)
array46 = c(1,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0)
array47 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0)
array48 = c(1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0)
array49 = c(0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1)
array50 = c(1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0)
array51 = c(0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0)
array52 = c(1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0)
array53 = c(0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0)
array54 = c(0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0)

final = array(c(array1, array2, array3, array4, array5, array6, array7, array8,array9,array10,array11,array12,array13,array14,array15,array16,array17,array18,array19,array20,array21,array22,array23,array24,array25,array26,array27,array28,array29,array30,array31,array31,array32,array33,array34,array35,array36,array37,array38,array39,array40,array41,array42,array43,array44,array45,array46,array47,array48,array49,array50,array51,array52,array53,array54), dim = c(54,22))

#DF_data = pd.DataFrame(final, index = ("sample_%d" % i for i in range(final.shape(0))),
#columns = ("attr_%d" % j for j in range(final.shape(1)))

data <- data.frame(name, final)

dend <- dist(x = data, method ="euclidean") %>%
hclust(method="ward.D") %>%
as.dendrogram()
plot(dend, labels = data$name)
leafcolor <- colormap(colormap = colormaps$viridis, nshades = 5, format = "hex", alpha = 1, reverse = FALSE)
par(mar=c(1,1,1,7))
dend %>%
set("labels_col", value = leafcolor, k=5) %>%
set("branches_k_color", value = leafcolor, k = 5) %>%
plot(horiz=TRUE, axes=FALSE)

Rplot

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.