使用卫星地图在R中创建气泡图 [英] Create bubble plot in R using satellite map

查看:195
本文介绍了使用卫星地图在R中创建气泡图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用以下代码创建了一个气泡图:

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)")

现在我得到包含气泡图的荷兰海岸地图(通过getData)。
不幸的是这是一个非常简单的地图。
我想有一个同一区域的卫星地图,显示更多的细节,以显示我的气泡图。有没有人知道这是否可行?
谢谢。

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.

推荐答案

我不知道你还是检查一下。但是,我为你留下一个方法。您可以使用缩放中的值播放,以便为您的目的确定最佳缩放。 ggmap 的CRAN手册为您提供更多示例。请看看。

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)

这篇关于使用卫星地图在R中创建气泡图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆