无法添加新图层 我有一个图,代表旧金山的邮政编码区域。 # Download San Francisco zip codes polygons path="http://moshetoronto.free.fr/blog/sfreal/geo_export_f72cfa08-0728-4a0b-bbcc-1fafc25de0f5.shp" filename="geo_export_f72cfa08-0728-4a0b-bbcc-1fafc25de0f5.shp" download.file(path,filename, mode = "wb") pathfile=paste0(getwd(),"/",filename) # load the file getwd() sfn = readOGR(dsn =pathfile ) %>% spTransform(CRS("+proj=longlat +datum=WGS84")) sfn.f<- sfn %>% fortify # build the map mysfn <- ggplot(data = sfn.f, aes(x=long, y=lat, group = id)) + geom_polygon(fill="white",alpha=1) + geom_path(color = "black",size=0.05,alpha=0.15)

无法添加新图层 我有一个图,代表旧金山的邮政编码区域。 # Download San Francisco zip codes polygons path="http://moshetoronto.free.fr/blog/sfreal/geo_export_f72cfa08-0728-4a0b-bbcc-1fafc25de0f5.shp" filename="geo_export_f72cfa08-0728-4a0b-bbcc-1fafc25de0f5.shp" download.file(path,filename, mode = "wb") pathfile=paste0(getwd(),"/",filename) # load the file getwd() sfn = readOGR(dsn =pathfile ) %>% spTransform(CRS("+proj=longlat +datum=WGS84")) sfn.f<- sfn %>% fortify # build the map mysfn <- ggplot(data = sfn.f, aes(x=long, y=lat, group = id)) + geom_polygon(fill="white",alpha=1) + geom_path(color = "black",size=0.05,alpha=0.15),r,ggplot2,layer,ggmap,R,Ggplot2,Layer,Ggmap,我只想在地图上标出这些点: # try to draw a contour plot mysfn + geom_point( data=myds, aes(x=long,y=lat),colour="red") 但它不起作用,我收到了以下错误消息: eval(expr、envir、enclose)中出错:找不到对象“id” 在geom_point中设置参数inherit.aes=FALSE,非常感谢您的支持!!! # try to draw a contour plot mysfn + geo

我只想在地图上标出这些点:

# try to draw a contour plot
mysfn + geom_point( data=myds, aes(x=long,y=lat),colour="red")
但它不起作用,我收到了以下错误消息:

eval(expr、envir、enclose)中出错:找不到对象“id”


geom_point
中设置参数
inherit.aes=FALSE
,非常感谢您的支持!!!
# try to draw a contour plot
mysfn + geom_point( data=myds, aes(x=long,y=lat),colour="red")