项目场景
R ggplot2 散点图;k-means可视化
绘图参数设置
问题描述
显示了geom_point()层的两个参数;
无法使用scale_size_discreate(legend = FALSE)和scale_alpha_discreate(legend = FALSE)、或在geom_point()中添加show.legend = FALSE关闭
# 展示对iris中两个变量(Sepal.Length, Petal.Length)用K-means聚类结果和实际Species的对比
library("ggplot2")
head(iris)
clusdata <- as.matrix(iris[, c(1, 3)])
nspes = length(unique(iris$Species))
clus <- kmeans(clusdata, centers