I want to have a map presenting value distribution over the area with some scale. Here is my data frame:
head(trip)
TIP LON LAT
1 1.318878 -73.9932 40.7223
2 1.370667 -73.9932 40.7222
3 0.933232 -73.9772 40.7559
4 1.268699 -73.9932 40.7628
5 1.265304 -73.9932 40.7429
6 1.193437 -73.9852 40.7447
I have generated a map using following code:
map <- ggmap::get_map("new york", zoom = 11)
nyc_map <- ggmap::ggmap(map, legend="topleft")
That map is properly displayed.
I have also generated a layer with my data representation:
ggplot(aes(LON,LAT, fill = TIP), data=as.data.frame(trip)) +
geom_tile() +
scale_fill_continuous(low="white", high="blue") +
coord_equal()
And this is also generated and displayed.
The issue is when I want to do this:
nyc_map +
ggplot(aes(LON,LAT, fill = TIP), data=as.data.frame(trip)) +
geom_tile() +
scale_fill_continuous(low="white", high="blue") +
coord_equal()
I am getting following error:
Error in p + o : non-numeric argument to binary operator
In addition: Warning message:
Incompatible methods ("+.gg", "Ops.data.frame") for "+"
I would be grateful if you could help me to join these two objects.