nature communications圖表復現(xiàn)之個性化地圖繪制

歡迎關注R語言數(shù)據(jù)分析指南

本節(jié)來復現(xiàn)nature communications上一篇文章中地圖的繪制方法,下面來進行復現(xiàn)過程,由于未找到作者提供的數(shù)據(jù)信息,小編自己構建了繪圖文件因此結果與原圖有出入僅供參考。整張圖均使用R代碼進行繪制

Land-use diversity predicts regional bird taxonomic and functional richness worldwide

論文原圖
復現(xiàn)圖

加載R包

# install.packages("rnaturalearthdata")

# install.packages("tidygeocoder")
library(tidygeocoder)
library(tidyverse)
library(sf)
library(camcorder)
library(scico)
library(rnaturalearth)
library(terra)
library(tidyterra)
library(geodata)
library(cowplot)
library(ggsci)

繪制點圖


df1 <- read_tsv("data.xls") %>% filter(type=="Taxonomic richness") %>% 
  select(5:9) %>% 
  group_by(REALM) %>% 
  slice_head(n=1)

df1$REALM <- factor(df$REALM,levels = c("Nearctic","Palearctic","Indomalayan","Neotropic","Afrotropic","Australasia"))  

plot1 <- df1 %>% ggplot(aes(y = fct_rev(REALM))) +
  theme_bw()+
  geom_errorbarh(aes(xmin=Lower_ci,xmax=Upper_ci),height=0.1) +
  geom_point(aes(x=visregFit,color=REALM),fill="black",size=3,show.legend = F) +
  labs(x="Taxonomic richness",y=NULL)+
  scale_color_npg()+
  theme(axis.ticks.y= element_blank(),
        axis.title.y= element_blank(),
        axis.title.x = element_text(color="black",size=8,face="bold"),
        axis.text.y=element_text(color="black",size=8,face="bold"),
        axis.text.x=element_text(color="black",size=8,face="bold"))


df2 <- read_tsv("data.xls") %>%
  filter(type=="Functional richness") %>% 
  select(5:9) %>% 
  group_by(REALM) %>% 
  slice_head(n=1)

df2$REALM <- factor(df$REALM,levels = c("Nearctic","Palearctic","Indomalayan","Neotropic","Afrotropic","Australasia"))  

plot2 <- df2 %>% ggplot(aes(y = fct_rev(REALM))) +
  theme_bw()+
  geom_errorbarh(aes(xmin=Lower_ci,xmax=Upper_ci),height=0.1) +
  geom_point(aes(x=visregFit,color=REALM),fill="black",size=3,show.legend = F) +
  labs(x="Functional richness",y=NULL)+
  scale_color_npg()+
  theme(axis.ticks.y= element_blank(),
        axis.title.y= element_blank(),
        axis.title.x = element_text(color="black",size=8,face="bold"),
        axis.text.y=element_text(color="black",size=8,face="bold"),
        axis.text.x=element_text(color="black",size=8,face="bold"))

好了本節(jié)介紹到此結束,非常簡單的一個案例喜歡的觀眾老爺歡迎分享轉發(fā),更多精彩案例歡迎關注我的公粽號R語言數(shù)據(jù)分析指南

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容