I had a discussion with the OP using his data. One of his issues was to make scale_colour_gradient2()
work. The solution was to set up a midpoint value. By default, it is set at 0 in the function. In his case, he has a continuous variable that has about 50 as median.
library(ggmap)
library(ggplot2)
library(RColorBrewer)
Europe2 <- get_map(maptype = "toner-2011", location = "Europe", zoom = 4)
ggmap(Europe2) +
geom_point(data = Cluster, aes(x = LON, y = LAT, color = Mean, shape = Höhe > 700), size = 1.5, alpha = 0.4) +
scale_shape_manual(name = "Altitude", values = c(19, 17)) +
scale_colour_gradient2(low = "#3288bd", mid = "#fee08b", high = "#d53e4f",
midpoint = median(Cluster$Mean, rm.na = TRUE))
It seems that the colors are not that good in the map given values seem to tend to stay close to the median value. I think the OP needs to create a new grouping variable with cut()
and assign colors to the groups or to use another scale_color type of function. I came up with the following with the RColorBrewer package. I think the OP needs to consider how he wanna use colors to brush up his graphic.
ggmap(Europe2) +
geom_point(data = Cluster, aes(x = LON, y = LAT, color = Mean, shape = Höhe > 700), size = 1.5, alpha = 0.4) +
scale_shape_manual(name = "Altitude", values = c(19, 17)) +
scale_colour_distiller(palette = "Set1")
solved R – ggplot – How to automatically set point color based on values?