R ggplot2每组颜色渐变

R ggplot2每组颜色渐变,r,ggplot2,R,Ggplot2,以下是我能够使其工作的示例: find_hull <- function(df) df[chull(df$Sepal.Length, df$Sepal.Width), ] hulls <- ddply(iris, "Species", find_hull) ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, shape=Species, color=Species, size=Petal

以下是我能够使其工作的示例:

find_hull <- function(df) df[chull(df$Sepal.Length, df$Sepal.Width), ]
hulls <- ddply(iris, "Species", find_hull)

ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, shape=Species, 
                         color=Species, size=Petal.Width)) + 
  geom_point() +
  ggtitle("Sepal.Length vs. Sepal.Width - size Petal.Width") +
  scale_shape_manual(values=c(15,16,17)) +
  geom_polygon(data = hulls, alpha = 0.15, size=0.2) +
  scale_size(guide = "none")
find_hull有点黑——为了获得“淡入白色”的效果,我添加了一个白色的
geom_点
,并用另一个
geom_点
覆盖,其中
alpha
映射到
Petal.Width
。因此,最大值为
Petal.Width
的点将为纯色,随着
Petal.Width
的减小,将逐渐变为白色

ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, shape=Species, 
                         color=Species, size=Petal.Width)) + 
  geom_point(colour = "white") +
  geom_point(aes(alpha = Petal.Width, colour = Species)) +
  ggtitle("Sepal.Length vs. Sepal.Width - size Petal.Width") +
  scale_shape_manual(values=c(15,16,17)) +
  geom_polygon(data = hulls, alpha = 0.15, size=0.2) +
  scale_size(guide = "none") +
  scale_alpha_continuous(guide = FALSE) 
输出:


我想为每个组(物种)指定特定的颜色,比如“橙色”/“黄色”/“黑色”,我该如何进行?