我有一个数据框架,其中有几个1918年之前的俄罗斯地区(" Gouvernement")以及带救济援助的大车数量:
df <- structure(list(Gouvernement = structure(c(31L, 22L, 19L, 13L,
29L, 18L, 17L, 27L, 4L, 25L, 35L, 28L, 7L, 34L, 15L, 24L, 2L,
10L, 16L, 23L, 8L, 6L, 26L, 3L, 20L, 1L, 32L, 14L, 12L, 30L,
11L, 5L, 21L, 9L, 33L), .Label = c("Amur", "Astrachan", "Buchera",
"Charkow", "Donsches Heeresgebiet", "Fergana", "Irkutsk", "Jennisejsk",
"Kaluga", "Kasan", "Kostroma", "Minsk", "Moskau", "Nischnij Nowgorod",
"Olonetz", "Orel", "Orenburg", "Pensa ", "Perm", "Priamur", "Rjasan",
"Samara ", "Samarkand", "Saratow", "Semipalatinsk", "Simbirsk",
"Syr-Darja", "Tobolsk", "Tomsk", "Trans-Kaspische Provinz", "Transbaikalien",
"Turgai", "Twer ", "Ufa", "Wjatka"), class = "factor"), Waggons = c(118,
75, 56, 46, 46, 40, 34, 32, 30, 26, 24, 22, 22, 20, 19, 18, 13,
13, 13, 12, 12, 9, 7, 6, 6, 6, 5, 4, 3, 3, 1, 1, 1, 1, 1)),
.Names = c("Gouvernement", "Waggons"), row.names = c(NA, -35L), class = "data.frame")
正如你所看到的,有些地区接收了大部分的大车,而其他地区只收到了一小部分:
ggplot(df, aes(x = Gouvernement, weight = Waggons)) +
geom_bar() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
我想打印一张热图,根据收到的Waggons的份额为区域着色。此热图应基于以下历史地图: Map of the Russian Empire 194-1918(TIFF with 21 Mb)
如何将此地图数字化并用它来创建R?
的热图我使用Mac,OS X Yosemite,R版本3.2.2和R Studio版本0.99.441。