当尝试在 RStudio Server 和 Shiny Server 中使用自动绘图绘制 OpenStreetMaps 时,出现错误。
require(maps)
require(ggplot2)
require(OpenStreetMap)
mp <- openmap(c(53.38332836757155,-130.517578125),
c(15.792253570362446,-67.939453125),4,'stamen-watercolor')
mp_bing <- openmap(c(53.38332836757155,-130.517578125),
c(15.792253570362446,-67.939453125),4,'bing')
states_map <- map_data("state")
states_map_merc <- as.data.frame(
projectMercator(states_map$lat,states_map$long))
states_map_merc$region <- states_map$region
states_map_merc$group <- states_map$group
autoplot.osmtile 3
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
p <- autoplot(mp,expand=FALSE) + geom_polygon(aes(x=x,y=y,group=group),
data=states_map_merc,fill="black",colour="black",alpha=.1) + theme_bw()
Run Code Online (Sandbox Code Playgroud)
错误是:
错误:自动绘图不支持 OpenStreetMap 类型的对象。
我使用的是 R 4.0.0 版本。
任何见解都会很棒,因为这在 R 版本 3.5.2 上运行得很好,在不同的 Shiny 服务器上也运行得很好。