gzh原文点我,欢迎同时关注
上一年,师姐特别喜欢我画的地图,让我不要藏私,拿出代码来分享分享。现在才想起来,其实也很简单,我就用下面的代码,来复现一下,发在virus evolution上的地图。
1.加载包
install.packages("reshape")
install.packages("rworldmap")
install.packages("rworldxtra")
require(reshape)
require (rworldmap)
require(rworldxtra)
2.载入数据
setwd("D:/本人信息/生信小书生/R语言绘图/2022-3-19-地图/饼状地图")
dat<-read.table("位置信息提取-4.txt",header = T,sep="\t",stringsAsFactors = F)
dat <- as.data.frame(dat)
3.绘图
plot(getMap())
p<-mapPies(dat,nameX="LON",nameY="LAT",nameZs=c("pos_686","pos_1605","pos_11075","pos_21765","pos_21991","pos_25700"),
mapRegion='world',symbolSize=1,barOrient='vert',ratio = 1,zColours=c("#4472A6","#93A8CE","#A94744","#4099AF","#8AA54F","#DB843E"),maxZVal=2,
lwd = 1.5,ylim=c(-60,90),barOrient='vert',oceanCol="#FFFFFF",landCol="#EBEBEB",borderCol="gray50")
参考:A comprehensive evolutionary and epidemiological characterization of insertion and deletion mutations in SARS-CoV-2 genomes