Whittaker生物群系,也称为生态系统分类法,是基于地理分布和环境条件等因素将地球表面的生态系统分为不同类型的系统。这种分类方法由美国生态学家罗伯特·惠特克(Robert Whittaker)于1962年提出,目的是为了更好地了解和描述生态系统的多样性和功能。
Whittaker使用两个因素对生物群落进行分类:降水和温度
image-20230314233906578
Whittaker生物群系根据气候和植被类型的组合,将地球表面的生态系统划分为五种类型:热带雨林、温带针叶林、温带落叶阔叶林、草原和沙漠。其中,热带雨林分布在赤道附近,气候温暖湿润,植被丰富多样;温带针叶林分布在北半球和南极洲的较高纬度地区,气候寒冷,植被以针叶树为主;温带落叶阔叶林分布在中、高纬度地区,气候四季分明,植被以落叶阔叶树为主;草原分布在中、低纬度地区,气候干燥,植被以草原为主;沙漠分布在低纬度地区,气候干燥,植被稀疏。
下图是一张发表在Nature子刊的图,用于展示不同采样点的气温、降水、高程和所属群落,信息丰富美观。
image-20230314234056033
来看看如何实现
R语言plotbiomes包
用两行代码就能进行一个最简单的实现:
library(plotbiomes)
whittaker_base_plot()
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
Whittaker_biomes是绘制的基本数据,如果考虑修改形状,可以修改该数据:
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
基于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)
上面使用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)
子刊结果复现
为了复现子刊效果,还需要添加一些点
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-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()
子刊中的图还映射了不同颜色的高程,并且有白色边界,很美观
点的边界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()
最后用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-20230314235712206
Whittaker生物群系分类方法不仅考虑了植物和动物的组成,还考虑了环境因素对生态系统的影响。它为生态学研究提供了一个框架,使我们能够更好地了解不同生态系统的特点和功能,更好地保护和管理生态系统。