我正在绘制一张地图,其中包含不同的疟疾寄生虫耐药性研究地点。研究地点的点的大小与采样的疟原虫数量相关,并且这些点的填充是从 0 到 1 的具有耐药性的疟原虫比例的梯度。以下代码显示了下面的地图:
###GENERATING AFRICA MAP###
africa = readOGR("/Users/transfer/Documents/Mapping Files/Africa Countries/Africa_SHP", layer="dissolved")
#FIXING THE NON-NODED INTERSECTS#
africa = gBuffer(africa, width=0, byid=TRUE)
#CREATING DATA FRAME FOR GGPLOT#
africa.map = fortify(africa, region="ID")
###PLOTTING SPM.437###
#SCALING THE SAMPLE SIZE USING CUBE-ROOT#
size = d.spm.437$Tot437^(1/3)
#PLOTTING#
ggplot(africa.map, aes(x = long, y = lat, group = group)) +
geom_polygon(colour="black", size=0.25, fill="white", aes(group=group)) +
geom_point(data = d.spm.437, aes(x = long, y = lat, fill=Frc437, group=NULL, size=Tot437),
size=size, shape=21, colour="black", size=0.5)
我尝试使用颜色选项,但它不起作用:
ggplot(africa.map, aes(x = long, y = lat, group = group)) +
geom_polygon(colour="black", size=0.25, fill="white", aes(group=group)) +
geom_point(data = d.spm.437, aes(x = long, y = lat, colour="red", fill=Frc437, group=NULL, size=Tot437),
size=size, shape=21, colour="black", size=0.5)
任何人都知道如何让填充的颜色显示红色的比例,较浅的为 0,较暗的为 1?