在地图上绘制值时出现奇怪错误

时间:2016-03-09 12:31:38

标签: r ggplot2

我正在使用以下data.frame

x <- c(36.63, 41.99, 41.96)
y <- c(-91.69, -87.93, -87.91)
z <- c(14, 2, 3)

locationCrimes <- data.frame(long = x, lat = y, Frequency = z)

我现在要做的是在芝加哥地图上绘制数据。所以我这样做:

library(ggmap)
chicago <- get_map(location = 'chicago', zoom = 11)

尝试使用以下方式绘制它:

ggmap(chicago) + geom_tile(data = locationCrimes, aes(x = long, y = lat, alpha = Frequency),
+                            fill = 'red') + theme(axis.title.y =  element_blank(), axis.title.x = element_blank())

但这给了我以下警告:

 Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(diff(sort(x))) : no non-missing arguments to min; returning Inf
4: In min(x) : no non-missing arguments to min; returning Inf
5: In max(x) : no non-missing arguments to max; returning -Inf
6: In min(diff(sort(x))) : no non-missing arguments to min; returning Inf
7: Removed 3 rows containing missing values (geom_tile).

任何想法出错的地方?

0 个答案:

没有答案