织梦CMS - 轻松建站从此开始!

欧博ABG-会员注册-官网网址

Getting a map with points, using ggmap and ggplot

时间:2025-08-25 21:40来源: 作者:admin 点击: 17 次
I want a map with points (and other geom_* layers) on it. I get the map, but instead of the points all I get is a warning: Message d'avis : Removed 3

I want a map with points (and other geom_* layers) on it. I get the map, but instead of the points all I get is a warning:

Message d'avis : Removed 3 rows containing missing values (geom_point).

Here is a reproducible exemple:

library(ggmap) library(ggplot2) d <- data.frame(lat=c(50.659631, 50.607213, 50.608129), lon=c(3.09319, 3.011473, 3.031529)) Lille <- get_map("Lille,France", zoom=12) p <- ggmap(Lille) p <- p + geom_point(data=d, aes(lat, lon)) p

Looking in the output of

ggplot_build(p)

I see a layer with NAs for x and y, but I do not get why the data from d is not considered.

When using ggplot() instead of ggmap(), I do get the points. But I do need the map too :)

So, how can I get a map with points over it?

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-09-04 03:09 最后登录:2025-09-04 03:09
栏目列表
推荐内容