【问题标题】:Create bubble plot in R using satellite map使用卫星地图在 R 中创建气泡图
【发布时间】:2014-05-02 11:50:11
【问题描述】:

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

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)。 不幸的是,这是一张非常简单的地图。 我想要一张相同区域的卫星地图,显示更多细节,以显示我的气泡图。 有谁知道这是否可能? 谢谢。

【问题讨论】:

    标签: r map plot satellite


    【解决方案1】:

    我不确定你是否仍然检查 SO。但是,我给你留下了一种方法。您可以使用缩放中的值来确定适合您目的的最佳缩放。 ggmap 的 CRAN 手册为您提供了更多示例。请看一下。

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

    【讨论】:

      猜你喜欢
      • 2021-09-20
      • 2015-04-23
      • 2019-01-03
      • 2014-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-28
      相关资源
      最近更新 更多