I am in 2 weeks into programming into R, and I am doing hierarchical clustering (using agnes) on a set of 150 documents. When I do the clustering, the plot looks really bad as all of the labels overlap, it basically looks like a mess. What is the best way to
Here's the code I'm using
cluster<- agnes(sim_matrix,diss="TRUE",method="ward")
dimnames(sim_matrix) = list(docnames, docnames)
plot(cluster)
Save the output to a file:
pdf(file="dendrogram.pdf", height=10, width=30)
plot(cluster, which.plots=2, cex=1)
dev.off()
Change the height and width of the pdf until the labels and the dendrogram are visible. You can also adjust font size via cex argument.
If you prefer the PNG or other file formats, check ?png
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With