I am trying to plot my data with ggplot2 onto a map using ggmap
my script is
require(akima) #this package interpolate values
require(ggplot2)
Space1 <- subset(x = ChlaMD0_3, Depth <= 14 & !(Station %in% c("P10","P11","P12c")))
Space2 <- subset(x = ChlaMD0_3, Depth <= 14 & Station %in% c("P10","P11") & Time == "D")
Space <- rbind(Space1,Space2)
duplicated(Space)
attach(Space)
fld <- with(Space, interp(x = Longitud.E., y = Latitude.S., z = Chla2017_mean,duplicate = "mean"))
gdat <- interp2xyz(fld, data.frame=TRUE)
library(ggmap)
map <- get_map("Marion Island",zoom=9)
dis_map <- ggmap(map)
dis_map +
ggplot(gdat) +
aes(x = x, y = y, z = z, fill = z) +
geom_tile() +
#coord_equal() +
geom_contour(color = "white", alpha = 0.5) +
scale_fill_distiller(palette="Spectral", na.value="white",limits=c(0,0.35)) +
scale_y_reverse()+
theme_bw()+
ggtitle("Chlorophyll-a (class size 0.3-2.7 um)")+
ylab("Latitude S") + xlab("Longitude E")+
labs(fill = "Chl-a (mg/m3)")+
geom_point(data = Space, mapping = aes(Longitud.E.,Latitude.S.),shape=1)
R returns error
Error: Don't know how to add o to a plot