我一直试图在地图上绘制一些数据。 随着观察数据的绘图圆圈按比例变化。
但产生的情节并未反映出规模。
这是我试过的代码。
newmap <- get_map(location = c(lon = 82.5,lat = 24),zoom=4, color="bw")
ggmap(newmap, extent = "normal") +
geom_point(aes(x = lon, y = lat, colour = scale , size = scale), data = final_data)
我从以下post获得了代码。
我的数据看起来像这样。
> final_data
lon lat disab scale
1 74.79728 34.083671 27832 1
2 74.87226 31.633979 28119 1
3 75.85728 30.900965 34830 1
4 77.31779 28.408912 33579 1
5 77.10249 28.704059 228427 6
6 75.78727 26.912434 74541 2
7 73.02431 26.238947 24898 1
8 75.86475 25.213816 20843 1
9 77.70641 28.984462 27864 1
10 77.45376 28.669156 84458 2
11 78.00807 27.176670 54382 2
12 80.94617 26.846694 77684 2
13 80.33187 26.449923 81988 2
14 81.84631 25.435801 37750 1
15 82.97391 25.317645 39408 2
16 85.13756 25.594095 68869 2
17 86.95240 23.673945 24627 1
18 88.36390 22.572646 342319 8
19 86.43039 23.795653 28865 1
20 86.20288 22.804566 20766 1
21 85.30956 23.344100 22957 1
22 81.28492 21.190449 22061 1
23 81.62964 21.251384 25868 1
24 78.18283 26.218287 18434 1
25 75.85773 22.719569 56279 2
26 77.41262 23.259933 73219 2
27 79.98641 23.181467 32597 1
28 72.57136 23.022505 188917 5
29 70.80216 22.303894 20219 1
30 73.18122 22.307159 47587 2
31 72.83106 21.170240 55055 2
32 75.34331 19.876165 36205 1
33 79.08815 21.145800 63969 2
34 73.78980 19.997453 26572 1
35 72.83973 19.391928 37382 1
36 72.81771 19.003050 484688 11
37 73.85674 18.520430 127858 3
38 78.48667 17.385044 294072 7
39 80.64802 16.506174 40592 2
40 NA NA 53865 2
41 77.61586 12.941483 251561 6
42 75.37037 11.874477 33907 1
43 75.78041 11.258753 51981 2
44 76.07400 11.073182 31863 1
45 76.21443 10.527642 38573 2
46 76.26730 9.931233 41432 2
47 76.61414 8.893212 23403 1
48 76.93664 8.524139 39024 2
49 80.27072 13.082680 163428 4
50 78.70467 10.790483 14489 1
51 78.11978 9.925201 19890 1
52 76.95583 11.016844 32794 1
如果有人可以帮我解决问题,那将会有很多帮助.. :) 提前谢谢。
答案 0 :(得分:0)
它不起作用,因为您的数据中没有myscale
列:final_data
。
将myscale
更改为scale
:
newmap <- get_map(location = c(lon = 82.5,lat = 24),zoom=4, color="bw")
ggmap(newmap, extent = "normal") +
geom_point(aes(x = lon, y = lat, colour = scale , size = scale), data = final_data)