【发布时间】:2019-03-27 22:46:26
【问题描述】:
我正在尝试在地图“UKmap”上绘制英国每个行政港口“AdminPort”中的船只数量“n”,在我的代码中,我将大小设置为等于 n(船只数量),所以点绘制在地图上取决于船只的数量。即使 n 是一列数字,我也会不断收到错误消息:
"UKmap + geom_point 中的错误(aes(x = Longitude, y = Latitude), size = 4, : 二元运算符的非数字参数
另外:警告信息: “+”的不兼容方法(“Ops.raster”、“+.gg”)
我做错了什么?我在下面添加了我的代码和 30x4 tibble (AdminPortCLL)。
# A tibble: 30 x 4
lon lat AdminPort n
<dbl> <dbl> <chr> <int>
1 -2.10 57.1 ABERDEEN 70
2 -4.63 55.5 AYR 77
3 -5.93 54.6 BELFAST 187
4 -3.52 50.4 BRIXHAM 184
5 -2.96 57.7 BUCKIE 69
6 -5.61 55.4 CAMPBELTOWN 97
7 -2.09 55.9 EYEMOUTH 73
8 -3.01 53.9 FLEETWOOD 92
9 -2.02 57.7 FRASERBURGH 120
10 -0.0736 53.6 GRIMSBY 56
# ... with 20 more rows
UKmap +
geom_point(aes(x = Longitude, y = Latitude),
size = n, data = AdminPortCLL) +
theme(legend.position = "top")
【问题讨论】:
-
您可能希望在
aes中使用size = n -
当我在 aes 中移动尺寸时,我仍然收到相同的错误消息。
-
什么是 UKmap - 没有这个问题就无法重现。如果您将 UKmap 替换为
ggplot(),您的代码是否有效?