2014-11-17 962 views

risposta

3

Soluzione: utilizzare la funzione set, con il parametro "labels_cex" dal pacchetto dendextend.

# install.packages("dendextend") 
library(dendextend) 

dend <- as.dendrogram(hclust(dist(USArrests[1:5,]))) 
# Like: 
# dend <- USArrests[1:5,] %>% dist %>% hclust %>% as.dendrogram 

# By default, the dend has no text size to it (showing only the first leaf) 
get_leaves_nodePar(dend)[[1]] 
par(mfrow = c(1,2), mar = c(10,4,4,2)) 
plot(dend, main = "Original dend") 

# let's increase the size of the labels: 
dend <- set(dend, "labels_cex", 2) 
# Now each state has a larger label 
get_leaves_nodePar(dend)[[1]] 
plot(dend, main = "A larger font for labels") 

enter image description here

(notare che la modifica della spaziatura tra le etichette non è attualmente implementato)

Per maggiori dettagli sul pacchetto, è possibile avere uno sguardo at its vignette.