Creating a Bubble Plot in R Using a Satellite Map
I have already created a bubble graph 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)")
I now get a Dutch coast map containing the bubble region (via getData). Unfortunately, this is a very simple map. I would like to have a satellite map of the same area that shows in more detail to show my portion of the bubble. Does anyone know if this is possible? Thank.
0
source to share
1 answer
I'm not sure if you are still checking SO. But I leave one approach for you. You can play with the values ββin the scaling to determine the optimal scaling for your purpose. CRAN's guide ggmap
offers you more examples. Please look.
map <- get_map(location = 'netherlands', zoom = 7,
source = 'google',
maptype = 'satellite')
ggmap(map)
+1
source to share