I simply try to plot kind of radar data on a map. The RData for that is an array with dimension [1:3,1:421,1:461,1:25].
I have a lat and lon data grid from mylat[1:421,1:461] and mylon[1:421,1:461] which give the information where to put my points.
sbbox <- make_bbox(lon = mylon, lat = mylat, f = .1)
gmap <- get_map(location = sbbox, maptype = "terrain", source = "google")
vlambda <- as.vector(lambda[m,,,t])
dflambda <- as.data.frame(vlambda)
ggmap(gmap)+
theme(panel.background = element_rect(fill ="white", colour="grey50")) +
#scale_x_continuous(limits = c(x1,x2), expand = c(0, 0)) +
#scale_y_continuous(limits = c(y1, y2), expand = c(0, 0)) +
ggtitle(bquote(paste(Lambda," [ ",mm^-1,"]"," @", .(t-1)," UTC"))) +
geom_point(data=dflambda,mapping=aes(x=as.vector(mylat),y=as.vector(mylon)))
ggsave(file=paste0("lambda_ggplot_map_plot_",names[m],".pdf"), dpi=150, device="pdf")
}
The grid where the data points should be located at looks like that (its a spherical projection): latlongrid
I thought it could work the way I wrote it, but probably I confused some things. The scale_x is optional at the moment, but I want to cut out a specific region afterwards. What also would be nice to have is a "z-axis" colouring like in image.plot.
When I run the code above it says:
Removed 194081 rows containing missing values (geom_point).
Does someone has an idea how it could work? :)
Further information:
The Array contains a lot of NAs. (#dflambda[is.na(dflambda)] <- 0
doesn't work). "m" and "t" are fixed, but should be looped later on. I guess my "array-to-df" converting is not perfect, but I just don't know how I could do better.. So any way how to create a nicely sorted data.frame is welcome.
Sorry for when I do misnomers, I'm relatively new to all this.
Looking forward for answers! :)