2
I am working with k-Means and therefore need to generate intuitive graphics.
However, the graph generated by the function fviz_cluster()
is not responding to usual functions in ggplot objects. In an attempt to modify the caption title, for example, it adds another caption. Also, I cannot rename the caption values to my determination names.
# Data
data("iris")
iris.scaled <- scale(iris[, -5])
# K-means clusters
km.res <- kmeans(iris.scaled, 3, nstart = 10)
# Visualize
library(factoextra)
pl_stack <- fviz_cluster(km.res, iris[, -5],ellipse.type = "norm") +
scale_fill_discrete(name="Experimental\nCondition",
breaks=c("1", "2", "3"),
labels=c("Control", "Treatment 1", "Treatment 2"))
pl_stack
Note that another caption has been generated instead of modifying the existing one. How to solve this?