我想在一个绘制的ASCII文件(作为矩阵)下添加一个地图,或者至少在该图中包括国家边界。该数据集是从GAEZ(http://www.gaez.iiasa.ac.at/)中检索到的,但是必须注册才能访问数据。
这是ASCII文件,我提取了:Link
我使用SDMTools包读取文件,然后使用fill.contour读取和绘制芬兰的数据集。
library(SDMTools)
library(viridis)
read.asc("...\\grid_temperature_2080\\data.asc", gz = FALSE)
x <- read.asc("...\\grid_temperature_2080\\data.asc", gz = FALSE)
filled.contour(x, col = viridis(24, option = "D"),
levels = seq(100, 220, 5),
plot.title = {par(cex.main=1);title(main = "Estimated Thermal Regime 2080 (CCCma CGCM2 B2)",
xlab = "Longitude", ylab = "Latitude")},
key.title = {par(cex.main=0.8);title(main="days > 5oC")},
plot.axes = {contour(x, levels = seq(100,220,10), add = TRUE, lwd=2)}
)
它给了我这张地图(对不起,我没有足够的声誉来发布图片
https://i.ibb.co/7vhDWNt/Rplot.jpg
我想有一个这样的背景
https://i.ibb.co/dB2DXzQ/map.png
我尝试添加map
library(maps)
map(database = "finland", regions = ".", exact = FALSE, boundary = TRUE,
interior = TRUE, projection = "", parameters = NULL, orientation = NULL,
fill = FALSE, col = 1, plot = TRUE, add = TRUE, namesonly = FALSE,
xlim = NULL, ylim = NULL, wrap = FALSE, resolution = if (plot) 1 else 0,
type = "l", bg = par("bg"), mar = c(4.1, 4.1, par("mar")[3], 0.1),
myborder = 0.01, namefield="name", lforce="n")
并得到“ as_mapper(.f,...)中的错误:参数“ .f”丢失,没有默认值”
我尝试了一些变体,但再也没有变。
感谢您的努力!