我想像本教程中那样绘制一种 isarhytmoc 点图,但要使用人口数据。然而,不幸的是,我没有足够的技能,只有这样的代码:
require(sp)
require(rgdal)
require(RColorBrewer)
require(ggplot2)
library(plyr)
library(maptools)
library(rgeos)
require(gpclib)
gpclibPermitStatus()
gpclibPermit()
rus<-url("http://www.filefactory.com/file/4h1hb5c1cw7r/n/RUS_adm1_RData")
print(load(rus))
proj4.str <- CRS("+init=epsg:3413 +lon_0=105")
gadm.prj <- spTransform(gadm, proj4.str)
popul <- read.csv2(file="C:\\unempl11.txt", header = TRUE,
sep = ";",quote = "", dec=",", stringsAsFactors=F)
df <- fortify(gadm.prj, region = "ID_1")
df2 <- merge(df, gadm.prj, by.x="id", by.y="ID_1")
p <- ggplot(df2, aes(x = long, y = lat, group=group)) +
geom_point(data = popul,
mapping = aes(x=lon, y=lat, colour=abs),
size = 3,
alpha = 0.8) +
scale_colour_gradient2(name = "Population",
low = "darkred",
mid = "white",
high = "blue",
guide = "colorbar") +
ggtitle("Population in Russia)")
p + geom_path(data = df2,
mapping = aes(x=long, y=lat, group=group),
size = 0.125)
这是我使用的数据,如果有人可以帮助我提出一些想法,我将不胜感激。