简体   繁体   中英

Create bubble plot in R using satellite map

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM