我一直试图描绘南极洲周围企鹅的位置。我已经能够绘制地图,但是当我尝试用企鹅位置覆盖点时,值将被删除。 我收到了错误
Removed 70 rows containing missing values (geom_point).
我的价值观似乎都在地图的范围内。
这是我的代码:
library(ggmap)
library(ggplot2)
library(ggmap)
library(maps)
library(mapdata)
options(stringsAsFactors = FALSE)
bari <- structure(list(x = 1:6, long = c(-66.5, -62.12, -60.38, -54.25,
-66.15, -22.58), lati = c(163, 58.07, 45.14, 22.8, 67.35, 18.21
), group = c(1L, 1L, 1L, 1L, 1L, 2L), order = 1:6, region = c("Pygoscelis adeliae",
"Pygoscelis adeliae", "Pygoscelis adeliae", "Pygoscelis adeliae",
"Pygoscelis adeliae", "Spheniscus demersus"), subregion = c(NA,
NA, NA, NA, NA, NA)), .Names = c("x", "long", "lati", "group",
"order", "region", "subregion"), row.names = c(NA, 6L), class = "data.frame")
attach(bari)
peng <- data.frame(long,lat,region,group,order,AsNumeric = TRUE)
world <- map_data("world")
worldmap <- ggplot(world, aes(x=long, y=lat, group=group)) +
geom_path() +
scale_y_continuous(breaks=(-2:2) * 30) +
scale_x_continuous(breaks=(-4:4) * 45)
worldmap + geom_point(data=peng,aes(x=long, y=lat),pch=21,size=5,colour=NA) + coord_cartesian(ylim=c(0,300)) + coord_map("ortho", orientation=c(-90, 0, 0))
Warning message:
Removed 70 rows containing missing values (geom_point).
提前感谢您的帮助。