我试图使用ggmap与ggplotly,我有困难,使软件包一起工作。对错误消息的搜索让我得到了这里。但是,我不确定aes继承是如何/可能是一个问题。奇怪的是,用ggmap创建的“myPlot”在RStudio中工作得很好,但不能以切换的方式连接。地图数据来自这里。
这两个包能一起工作吗?(顺便说一句,我不能用这种方式来标记这个包,我认为这个包以前并没有被引用过。)
码
lapply(list("ggplot2", "ggmap", "mapproj", "RCurl", "RJSONIO", "plyr"),
require, character.only=TRUE)
# install.packages("devtools")
library("devtools")
# install_github("plotly", "ropensci")
library(plotly)
mapImageData1 <- get_map(location = c(lon = -0.016179, lat = 51.538525),
color = "color",
source = "google",
maptype = "satellite",
zoom = 17)
myMap = ggmap(mapImageData1,
extent = "device",
ylab = "Latitude",
xlab = "Longitude")
py <- plotly("RgraphingAPI", "ektgzomjbx")
res <- py$ggplotly(gg = p_map)错误消息
res <- py$ggplotly(gg = p_map)在eval中的错误(expr,环境,附件):找不到对象'lon‘
发布于 2016-11-23 11:24:07
只需在现有的dataframe中替换纬度和经度的列名,如下所示
(如果p_map是您的数据)
setnames(p_map, "Latitude", "lat")
setnames(p_map, "Longitude", "lon")https://stackoverflow.com/questions/23373908
复制相似问题