我使用来自世界气候的数据为特里尼达岛制作了一张雨量地图。然而,地图并不平滑。我想知道如何获得一个平滑的地图。我已经附上了我的代码与地图。任何帮助都将不胜感激。
library(dplyr)
library(tidyr)
library(sp)
library(ggplot2)
library(rgeos)
library(maptools)
library(rgdal)
library(raster)
library(rasterVis) #visualization library for raster
TT=getData('GADM', country='Trinidad and Tobago', level=1)
plot(TT) # this can be a little slow
clim=getData('worldclim', var='bio', res=2.5)
clim
gain(clim)=0.1
plot(clim[[12]])
gplot(clim[[12]])+geom_raster(aes(fill=value))+
facet_wrap(~variable)+
scale_fill_gradientn(colours=c("brown", "red", "yellow", "darkgreen", "green"),trans="log10") +
coord_equal()
## crop to a latitude/longitude box
r1 <- crop(clim[[12]], extent(-62,-60,10,12))
## Crop using a Spatial polygon
r1 <- crop(clim[[12]], bbox(TT))
plot(r1)发布于 2021-04-28 03:08:21
您的数据:
library(raster)
TT <- getData('GADM', country='Trinidad and Tobago', level=1)
clim <- getData('worldclim', var='bio', res=2.5)
r <- crop(clim[[12]], TT)解决方案:
x <- disaggregate(r, 5, method="bilinear")
y <- mask(x, TT)
plot(y)https://stackoverflow.com/questions/67274552
复制相似问题