复现Nature子刊Whittaker生物群系图

Whittaker生物群系,也称为生态系统分类法,是基于地理分布和环境条件等因素将地球表面的生态系统分为不同类型的系统。这种分类方法由美国生态学家罗伯特·惠特克(Robert Whittaker)于1962年提出,目的是为了更好地了解和描述生态系统的多样性和功能。

Whittaker使用两个因素对生物群落进行分类:降水和温度

image-20230314233906578
image-20230314233906578

Whittaker生物群系根据气候和植被类型的组合,将地球表面的生态系统划分为五种类型:热带雨林、温带针叶林、温带落叶阔叶林、草原和沙漠。其中,热带雨林分布在赤道附近,气候温暖湿润,植被丰富多样;温带针叶林分布在北半球和南极洲的较高纬度地区,气候寒冷,植被以针叶树为主;温带落叶阔叶林分布在中、高纬度地区,气候四季分明,植被以落叶阔叶树为主;草原分布在中、低纬度地区,气候干燥,植被以草原为主;沙漠分布在低纬度地区,气候干燥,植被稀疏。

下图是一张发表在Nature子刊的图,用于展示不同采样点的气温、降水、高程和所属群落,信息丰富美观。

image-20230314234056033
image-20230314234056033

来看看如何实现

R语言plotbiomes包

用两行代码就能进行一个最简单的实现:

library(plotbiomes)
whittaker_base_plot()
image-20230314234435011
image-20230314234435011

该绘制基于ggplot,可以用ggplot实现相同的结果:

library(plotbiomes)
library(ggplot2)

plot_1 <- ggplot() +
  # add biome polygons
  geom_polygon(data = Whittaker_biomes,
               aes(x    = temp_c,
                   y    = precp_cm,
                   fill = biome),
               # adjust polygon borders
               colour = "gray98",
               size   = 1) +
  theme_bw()
plot_1
alt

Whittaker_biomes是绘制的基本数据,如果考虑修改形状,可以修改该数据:

image-20230314234635486
image-20230314234635486

进一步修改颜色,如使用Whittaker_biomes的经典颜色,

Ricklefs_colors是包附带的预定义颜色矢量plotbiomes。这些是Ricklefs, RE (2008)中使用的颜色:

Ricklefs_colors
plot_2 <- plot_1 +
  # fill the polygons with predefined colors
  scale_fill_manual(name   = "Whittaker biomes",
                    breaks = names(Ricklefs_colors),
                    labels = names(Ricklefs_colors),
                    values = Ricklefs_colors)
plot_2

alt

基于ggplot图层,可以进行更多细节修饰,与ggplot图层语法一起使用:

whittaker_base_plot() + theme_bw()
  • 可以使用不同的配色来增加美观,如使用RColorBrewer包

  • 第二种我使用了自定义调色板

library(RColorBrewer)

# the main rule - create 9 colors for the 9 biomes

# failed trial with RColorBrewer :)
my_palette_1 <- rev(brewer.pal(n = 9, name = "BrBG"))
whittaker_base_plot(color_palette = my_palette_1)

# this seems a better approach - interpolate 9 colors from given main 3  
my_palette_2 <- colorRampPalette(colors = c("#F5F5F5",  "#01665E""#8C510A"))(9)
whittaker_base_plot(color_palette = my_palette_2)
alt

上面使用whittaker_base_plot()封装的方法,可以用ggplot自定义:

names(my_palette_2) <- names(Ricklefs_colors)

ggplot() +
  # add biome polygons
  geom_polygon(data = Whittaker_biomes,
               aes(x    = temp_c,
                   y    = precp_cm,
                   fill = biome),
               # adjust polygon border
               colour = "gray98",
               size   = 1) +
  # fill the polygons with desired colors
  scale_fill_manual(name   = "Whittaker biomes",
                    breaks = names(Ricklefs_colors),
                    labels = names(Ricklefs_colors),
                    values = my_palette_2)
alt

子刊结果复现

为了复现子刊效果,还需要添加一些点

image-20230314235120540
image-20230314235120540

添加随机点,生成随机位置并从 WorldClim 数据中提取温度和降水量。

library(raster)
library(maptools)

path <- system.file("extdata""temp_pp.tif", package = "plotbiomes")
temp_pp <- raster::stack(path)
names(temp_pp) <- c("temperature""precipitation")

data(wrld_simpl) # load world polygons from maptools

wrld_simpl <- wrld_simpl[wrld_simpl$NAME != "Antarctica", ]

set.seed(66) # random number generator
points <- sp::spsample(x = wrld_simpl, n = 50, type = "random")

extractions <- raster::extract(temp_pp, points, df = TRUE)

extractions$temperature <- extractions$temperature/10

extractions$precipitation <- extractions$precipitation/10
extractions$Elevation <- runif(10) * 100
plot(temp_pp[[1]]/10); points(points)
plot(temp_pp[[2]]); points(points)
image-20230314235247536
image-20230314235247536
image-20230314235253850
image-20230314235253850

在whittaker_base_plot封装的基础上叠加点:

whittaker_base_plot() +
  # add the temperature - precipitation data points
  geom_point(data = extractions, 
             aes(x = temperature, 
                 y = precipitation), 
             size   = 3,
             shape  = 21,
             colour = "gray95"
             fill   = "black",
             stroke = 1,
             alpha  = 0.5) +
  theme_bw()
alt

子刊中的图还映射了不同颜色的高程,并且有白色边界,很美观

点的边界color和背景fill的颜色映射很有创意,也相对麻烦,因为fill已经用于生物群系多边形,并且ggplot2只允许一个scale。

所以,我们不能使用两个不同的fill映射。不过,有一个解决方法:

一个解决方案是调用两次geom_point(官方文档ggplot2 中的 6.4.1 图层和图例:用于数据分析的精美图形)。

第一次调用设置点的边界线,第二次调用点着色。

plot_3 <- whittaker_base_plot() +
  geom_point(data = extractions,
             aes(x = temperature,
                 y = precipitation),
             shape  = 21,
             stroke = 1, # acts as the thickness of the boundary line
             colour = "gray95"# acts as the color of the boundary line
             size   = 3.5) +
  geom_point(data = extractions,
             aes(x = temperature,
                 y = precipitation,
                 color = Elevation),
             shape = 16,
             size  = 3,
             alpha = 0.5) +
 scale_color_viridis_c()
plot_3 + theme_bw()
alt

最后用ggplot图层语言综合修饰,把图例放到边框内:

my_plot <- plot_3 +
  # Optional - Overwrite axis ranges (the scale warning is expected):
  # - set range on OY axes and adjust the distance (gap) from OX axes
  scale_y_continuous(name = 'Precipitation (cm)',
                     limits = c(min = -5, max = ceiling(max(460, extractions$precipitation)/10)*10) ,
                     expand = c(0, 0)) +
  # - set range on OX axes and adjust the distance (gap) from OY axes
  scale_x_continuous(name = expression("Temperature " ( degree*C)),
                     limits = c(min = floor(min(-20, extractions$temperature)/5)*5, max = 30.5),
                     expand = c(0, 0)) +
  coord_fixed(ratio = 1/10) + # aspect ratio, expressed as y / x
  theme_bw() +
  theme(
    legend.justification = c(0, 1), # pick the upper left corner of the legend box and
    legend.position = c(0, 1), # adjust the position of the corner as relative to axis
    legend.background = element_rect(fill = NA), # transparent legend background
    legend.box = "horizontal"# horizontal arrangement of multiple legends
    legend.spacing.x = unit(0.5, units = "cm"), # horizontal spacing between legends
    panel.grid = element_blank() # eliminate grids
  )
  my_plot
image-20230314235625571
image-20230314235625571

与子刊原图基本一致:

image-20230314235712206
image-20230314235712206

Whittaker生物群系分类方法不仅考虑了植物和动物的组成,还考虑了环境因素对生态系统的影响。它为生态学研究提供了一个框架,使我们能够更好地了解不同生态系统的特点和功能,更好地保护和管理生态系统。

本文由 mdnice 多平台发布

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Whittaker滤波是一种常用的信号处理方法,用于平滑离散数据。这种滤波方法是由Whittaker于1922年提出的,被广泛应用于信号恢复、数据插值和去噪等领域。 Whittaker滤波的基本思想是通过对离散数据进行插值和平滑,对信号进行重建。该方法在数据点附近使用多项式进行拟合,然后利用拟合曲线进行信号恢复。常用的拟合方法有牛顿插值法和Lagrange插值法。 Whittaker滤波的核心是最小化平滑函数与原始数据之间的误差,以获得平滑的信号。该算法基于线性二次规划问题,通过调整平滑参数来控制平滑程度。较大的平滑参数将导致更加平滑的信号,而较小的平滑参数将保留更多的信号细节。 Whittaker滤波的优点是可以有效地平滑离散数据,并提供灵活性和可调节性。它在信号恢复和数据插值中具有良好的效果,能够去除噪声和异常值,并还原数据的整体趋势。 然而,Whittaker滤波也有一些限制。它对数据的平滑程度非常敏感,平滑参数的选择需要经验和试验。此外,该方法在面对严重缺失数据或数据较大波动时可能不够稳定,可能导致信号失真或过度平滑。 总的来说,Whittaker滤波是一种常见且有效的信号处理方法,可以用于数据插值、信号恢复和去噪等应用。要合理选择参数,并注意其适用范围和局限性,以获得准确的结果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

地学万事屋

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值