我试图在地图上累积绘制每个月新增的位置。我已经能够创建每个月有新位置的动画,但无法进行累积。换句话说,我希望看到新位置添加到现有位置的地图上。
以下是示例数据:
DF <- data.frame("latitude" = c(42.29813,41.83280,41.83280,30.24354),
"longitude" =c(-71.23154,-72.72642,-72.72642,-81.62098),
"month" = c(1,2,3,4))
这是我的尝试
usa <- ggplot() +
borders("usa", colour = "gray85", fill = "gray80") +
theme_map()
map <- usa +
geom_point(aes(x = longitude, y = latitude, cumulative=TRUE,
frame=month,stat = 'identity' ),data = DF )
map
# Generate the Visual and a HTML output
ggp <- ggplotly(map)%>%
animation_opts(transition = 0)
ggp
输出结果不是累计的位置。基本上,我希望最终能看到所有四个位置。