Create bubble plot in R using satellite map

烂漫一生 提交于 2019-12-02 22:18:30

问题


I already created a bubble plot using the following code:

library(ggplot2)

library(sp)

library(raster)

library(maps)

library(mapdata)

library(maptools)

library(gstat)

library(ggmap)

xy <- se_pp[,c("longitude_s", "latitude_s")]

nl <- getData('GADM', country="Netherlands", level=2) #raster data, format SpatialPolygonsDataFrame

# coercing the polygon outlines to a SpatialLines object

spl <- list("sp.lines", as(nl, "SpatialLines"))

SPDF <- SpatialPointsDataFrame(coords=xy, data=se_pp)

projection(SPDF)<- "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0"

coordinates(SPDF)[1:5,] #retrieves spatial coordinates form the dataframe

bubble(SPDF, "Quantity", sp.layout=spl, main="Plaice Quantity (#/km2), end summer (Sand Engine)")

Now I get a map of the Dutch coast containing the bubble plot (via getData). Unfortunately this is a very simple map. I would like to have a satellite map of the same area, which shows more detail, to show my bubble plot. Does anyone know if this is possible? Thanks.


回答1:


I am not sure if you still check SO. But, I leave one approach for you. You can play with the values in zoom to identify the best zoom for your purpose. The CRAN manual of ggmap offers you more examples. Please have a look.

map <- get_map(location = 'netherlands', zoom = 7,
               source = 'google',
               maptype = 'satellite')

ggmap(map)


来源:https://stackoverflow.com/questions/23427479/create-bubble-plot-in-r-using-satellite-map

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!