Structure and function of the soil microbiome underlying N2O emissions from global wetlands
https://www.nature.com/articles/s41467-022-29161-3#Sec21
没有找到论文的代码,但是论文的数据是公开的,可以用论文中的数据复现一下论文中的结果,今天的推文试着复现一下论文中的figure1a
ggplot2自带了一份地图数据,可以直接使用,这里需要注意的是我们画的是没有国家边界的世界地图,如果是带有国家边界的地图,使用数据的时候需要小心。
library(ggplot2)
world<-map_data("world")
ggplot() +
geom_polygon(data=world,aes(x=long,y=lat,group=group),
fill="#dedede")+
theme_bw()+
scale_y_continuous(expand = expansion(mult=c(0,0)))+
scale_x_continuous(expand = expansion(add=c(0,0))) -> world.map
world.map
image.png
image.png
library(readxl)
dat01<-read_excel("data/20220603/NC/41467_2022_29161_MOESM12_ESM.xlsx",
sheet = "Fig.1a")
head(dat01)
dat01 %>%
mutate(n2o=case_when(
N2O<10 ~ "-2..10",
N2O >= 10 & N2O < 100 ~ "10..100",
N2O >= 100 ~ "100..500"
)) -> new.dat01
library(ggstar)
world.map +
geom_star(data=dat01,
aes(x=Longitude,y=Latitude,
starshape=Land_use,
color=`AamoA/nir`,
fill=`AamoA/nir`),
size=4,
position = position_jitter(width = 10,
height = 10,
seed = 1234))+
scale_starshape_manual(values=c(11:15,20,9))+
scale_fill_gradient2(low = "#429eb3",
mid = "#e9c922",
high = "#f22101",
midpoint = 0.5)+
scale_color_gradient2(low = "#429eb3",
mid = "#e9c922",
high = "#f22101",
midpoint = 0.5) -> world.map.01
world.map.01 +
geom_point(data=new.dat01,
aes(x=Longitude,y=Latitude,
shape=n2o),
position = position_jitter(width = 10,
height = 10,
seed = 1234))+
scale_shape_manual(values = c(3,4,8),
name= expression("A^2"))+
theme(#legend.position = c(0.5,0.5),
legend.background = element_rect(fill = "transparent"))+
labs(x="Longitude",y="Latitude")
image.png
这连个问题目前的解决办法是出图后编辑图片
采样地点数据可以到论文中去下载,代码可以在推文中复制