scale_color_gradientn() 没有产生正确的输出

scale_color_gradientn() not producing the correct output

我在使用 ggmap + ggplot 创建带有自定义网格的绘图时遇到问题。这是我用于一些快速生成的示例数据的绘图代码。它成功地生成了一个图,但忽略了我在 scale_color_gradientn() 中的自定义颜色。如有任何建议,我们将不胜感激!

library(ggplot2)
library(reshape2)
library(ggmap)

Lon <- runif(100, -100, -92)
Lat <- runif(100, 34, 45)
Conc <- runif(100, 1, 8)

JECeGRIDLoc <- c(39.2865, -96.1172)

PlotModel1 <- data.frame(Lat, Lon, Conc)


### What I need ###


al1 = get_map(location = c(lon = JECeGRIDLoc[2], lat = JECeGRIDLoc[1]), zoom 
= 06, maptype = 'satellite')
al1MAP = ggmap(al1)
al1MAP + geom_tile(data = PlotModel1, aes(x = Lon, y = Lat, fill = Conc)) + 
scale_fill_gradient(limits=c(min(min(PlotModel1$Conc), 
min(PlotModel2$Conc)), 
max(max(PlotModel1$Conc), max(PlotModel2$Conc))), low = "yellow", high = 
"red") +
scale_color_gradientn(colors = c("purple", "red", "orange", "yellow", 
"green")) +
xlab("Longitude") +
ylab("Latitude") +
ggtitle("Jeffrey Energy Center (2012): \n eGRID Model Dispersion Area")


### Additional example (does not work) ###


ggplot(data = PlotModel1, aes(x = Lon, y = Lat, fill = Conc)) +
geom_point() +
scale_color_gradientn(colors = c("purple", "red", "orange", "yellow", 
"green"))

将填充换成颜色,效果很好

ggplot(data = PlotModel1, aes(x = Lon, y = Lat, colour = Conc)) +
geom_point() +
scale_color_gradientn(colors = c("purple", "red", "orange", "yellow", 
                               "green"))