i have a question concerning hirarchical clustering with factoextra fviz_clust()
, so actually ggplot2 i guess.
In my Factor map the labels look like this
but i want to have it, that way more labels are shown, especially in cluster one. I know there is a way to incooperate ggrepel
, but i was not able to perfrom unfortunately. In this way, the labels "point" with a bar to the datapoint. That would be the best outcome.
the code looks like this:
factormap <- fviz_cluster(res.hcpc.Contr,
geom = c("text","point"),
repel = TRUE, # Avoid label overlapping
show.clust.cent = TRUE, # Show cluster centers
palette = "lancet", # Color palette see ?ggpubr::ggpar
ggtheme = theme_bw()+
theme(axis.text.x = element_text( hjust = 0.5, vjust = 0.5, size=15),
axis.title.x =element_text(size=20),
axis.text.y = element_text(hjust = 0.5, vjust = 0.5, size=15),
axis.title.y =element_text(size=20),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
strip.text = element_text(size=25)))
i am sorry that i can not give a reproducible sample.
can anyone help?
Okay the solution was that i had to set the max.overlaps
option of ggrepel
to inf
globally for the whole session.
options(ggrepel.max.overlaps = Inf)
Graph now