无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

R腳本-利用R繪制MaxEnt模型的環(huán)境因子響應曲線

2023-06-14 10:15 作者:一枚鄉(xiāng)野村姑  | 我要投稿

結果展示:

圖片

安裝所需的R包:

install.packages("dismo")

install.packages("ggplot2")

讀取maxent模型結果數(shù)據(jù):

library(dismo)

#?讀取模型結果數(shù)據(jù)

maxent_result <- read.table("maxent_results.txt", header = T, sep = "\t", skip = 39, stringsAsFactors = F)

#?讀取環(huán)境因子數(shù)據(jù)

env_data <- raster("environmental_data.tif")

計算環(huán)境因子響應曲線:

#?提取maxent模型結果中的環(huán)境因子數(shù)據(jù)

env_factor_data <- maxent_result[, grepl("x", colnames(maxent_result))]

#?生成環(huán)境因子響應曲線數(shù)據(jù)

env_curve_data <- data.frame()

for (i in 1:ncol(env_factor_data)) {

env_factor <- env_factor_data[, i]

env_curve <- data.frame(env_factor, response = predict(maxent_result, newdata = env_data, linear = TRUE, var = names(env_factor_data)[i]))

env_curve$env_name <- names(env_factor_data)[i]

env_curve_data <- rbind(env_curve_data, env_curve)

}

繪制環(huán)境因子響應曲線并導出結果:

library(ggplot2)

#?繪制環(huán)境因子響應曲線

env_curve_plot <- ggplot(env_curve_data, aes(x = env_factor, y = response, color = env_name)) +

geom_line(size = 1) +

scale_color_discrete(name = "Environmental factor") +

labs(x = "Environmental factor", y = "Response") +

theme_bw()

#?導出結果圖像

ggsave("environmental_factor_response_curve.png", env_curve_plot, width = 8, height = 6, dpi = 300)

說明:以上內容近期將安排線上培訓,感興趣的可以關注動態(tài)或私信“培訓”獲取具體培訓信息。



R腳本-利用R繪制MaxEnt模型的環(huán)境因子響應曲線的評論 (共 條)

分享到微博請遵守國家法律
威信县| 错那县| 枣强县| 兰溪市| 深泽县| 滁州市| 钟祥市| 手机| 长子县| 南江县| 土默特左旗| 繁峙县| 宁武县| 绩溪县| 大兴区| 西林县| 长宁县| 柏乡县| 襄汾县| 嘉定区| 大新县| 丹巴县| 阿坝| 理塘县| 嘉义县| 游戏| 汝州市| 平昌县| 政和县| 和静县| 甘洛县| 建德市| 吴旗县| 都昌县| 晋城| 蒙自县| 宁南县| 丁青县| 贺兰县| 林口县| 南皮县|