最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(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)境因子響應曲線的評論 (共 條)

分享到微博請遵守國家法律
新龙县| 阿图什市| 丁青县| 西华县| 修武县| 霍城县| 青冈县| 宜都市| 阆中市| 华宁县| 佛学| 新和县| 正定县| 龙井市| 西藏| 上饶县| 屏山县| 营口市| 抚远县| 吴川市| 收藏| 博客| 小金县| 湖北省| 五大连池市| 布尔津县| 鄂温| 阿尔山市| 鞍山市| 景谷| 东乡县| 徐水县| 景洪市| 巧家县| 福鼎市| 曲阳县| 哈巴河县| 大荔县| 宿迁市| 福海县| 十堰市|