我正在尝试在地图上绘制地理位置。我将 ggplot2 与地图库结合使用。
一切都很好,除了在非常拥挤的地区。我想放大这个区域,但我做不到。
所以我想放大加拉帕戈斯岛。这是我使用的脚本:
library(ggplot2)
library(maps)
measurements <- read.csv("all_podo.count.csv", header=T)
allworld <- map_data("world")
d <- ggplot(measurements, aes(long, lat)) +
geom_polygon(data = allworld, xlim = c(-50, 100), aes(x = long, y = lat, group = group),
colour = "grey70", fill = "grey70") +
geom_point(size = 0.7, shape = 8) +
opts(axis.title.x = theme_blank(),
axis.title.y = theme_blank()) +
geom_text(aes(label = name), size = 1, vjust = 0, hjust = 0)
d
测量结果如下所示:
structure(list(site_num = c(59L, 54L, 44L, 42L, 38L, 37L, 43L,
39L, 36L, 40L, 34L, 35L, 33L, 41L, 32L, 31L, 30L, 29L, 28L, 27L,
26L, 25L, 24L, 23L, 22L, 21L, 20L, 19L, 18L, 17L, 16L, 15L, 14L,
13L, 12L, 11L, 10L, 7L, 8L, 9L, 1L, 3L, 6L, 5L, 79L, 77L, 78L,
76L, 75L, 74L, 80L, 81L, 72L, 73L, 71L, 70L, 69L, 68L, 66L, 67L,
65L, 63L, 64L, 62L, 60L, 61L), name = structure(c(44L, 43L, 42L,
40L, 36L, 35L, 41L, 37L, 34L, 38L, 32L, 33L, 31L, 39L, 30L, 29L,
28L, 27L, 26L, 25L, 24L, 23L, 22L, 21L, 20L, 19L, 18L, 17L, 16L,
15L, 14L, 13L, 12L, 11L, 10L, 9L, 8L, 5L, 6L, 7L, 1L, 2L, 4L,
3L, 64L, 62L, 63L, 61L, 60L, 59L, 65L, 66L, 57L, 58L, 56L, 55L,
54L, 53L, 51L, 52L, 50L, 48L, 49L, 47L, 45L, 46L), .Label = c("GS000a",
"GS000b", "GS000c", "GS000d", "GS001a", "GS001b", "GS001c", "GS002",
"GS003", "GS004", "GS005", "GS006", "GS007", "GS008", "GS009",
"GS010", "GS011", "GS012", "GS013", "GS014", "GS015", "GS016",
"GS017", "GS018", "GS019", "GS020", "GS021", "GS022", "GS023",
"GS025", "GS026", "GS027", "GS028", "GS029", "GS030", "GS031",
"GS032", "GS033", "GS034", "GS035", "GS036", "GS037", "GS047",
"GS051", "GS108a", "GS108b", "GS109", "GS110a", "GS110b", "GS111",
"GS112a", "GS112b", "GS113", "GS114", "GS115", "GS116", "GS117a",
"GS117b", "GS119", "GS120", "GS121", "GS122a", "GS122b", "GS123",
"GS148", "GS149"), class = "factor"), lat = c(-15.143611, -10.131389,
-1.9738889, 1.3891667, -0.3011111, 0.27222222, -0.020833334,
-0.5938889, -0.2, -1.2283334, -1.2161111, -1.2169445, 1.2641667,
-0.38305557, 5.552778, 5.64, 6.492778, 8.129167, 9.164444, 10.716389,
18.036667, 20.5225, 24.174723, 24.488333, 32.506943, 36.003887,
38.946945, 39.417778, 38.94, 41.09111, 41.485832, 43.63222, 45.111668,
44.690277, 44.137222, 42.85278, 42.503056, 32.166668, 32.166668,
32.166668, 31.175, 31.175, 31.175, 32.174835, -32.399166, -30.898333,
-30.898333, -29.348888, -26.035, -23.21611, -6.3166666, -6.3166666,
-4.613611, -4.613611, -4.635, -4.6625, -4.990278, -7.0075, -8.505,
-8.505, -9.596945, -10.446111, -10.446111, -10.943611, -12.0925,
-12.0925), long = c(-147.435, -135.44945, -95.014725, -91.81695,
-91.651665, -91.63333, -91.19778, -91.06944, -90.83528, -90.42917,
-90.422775, -90.319725, -90.295, -90.279724, -87.087776, -86.56528,
-82.90389, -79.69111, -79.83611, -80.25445, -83.78472, -85.41361,
-84.344444, -83.07, -79.263885, -75.39472, -76.41722, -75.504166,
-74.685, -71.60222, -71.35111, -66.84722, -64.94666, -63.637222,
-63.644444, -66.217224, -67.24, -64.5, -64.5, -64.5, -64.32433,
-64.32433, -64.32433, -64.01017, 36.591946, 40.420277, 40.420277,
43.215557, 50.123055, 52.30611, 39.009167, 39.009167, 55.50861,
55.50861, 56.836113, 60.523056, 64.97667, 76.33139, 80.37556,
80.37556, 84.1975, 88.30278, 88.30278, 92.05889, 96.88167, 96.88167
)), .Names = c("site_num", "name", "lat", "long"), class = "data.frame", row.names = c(NA,
-66L))
你能帮助我吗 ?
谢谢,
西蒙