![](/img/trans.png)
[英]Is ggmap broken? Basic qmap() produces “arguments imply differing number of rows: 0,1”
[英]ggmap / ggplot error when plotting points on a ggmap: [arguments imply differing number of rows]
以下代碼工作正常:
library(ggmap)
mp2 <- ggmap::get_map(location="South America", zoom = 4, source="google")
ggmap(mp2) +
geom_point(aes(c(-60), c(-1)), size=15) # plot one single point on map
產生這個:
雖然以下因某些原因不會出現預期的情況:
ggmap(mp2) +
geom_point(aes(c(-60, -65, -62), c(-1, -5, -10)))
給我以下錯誤:
Error in data.frame(x = c(-60, -65, -62), y = c(-1, -5, -10), PANEL = c(1L, :
arguments imply differing number of rows: 3, 4
這應該工作
df <- data.frame(lon=c(-60, -65, -62), lat = c(-1, -5, -10))
ggmap(mp2) +
geom_point(aes(x = lon, y = lat), size = 10, data = df)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.