library(terra)
library(raster)
library(rasterVis)
f <- system.file("external/test.grd", package="raster")
r <- rast(f)
r
rr <- project(x=r,y='epsg:4326')
rr
gplot(rr)+
geom_raster(aes(fill = value),na.rm=T)+
scale_fill_distiller(na.value = NA)+
ggtitle(label = 'Test')+
coord_sf(crs=4326)+
theme(axis.title = element_blank(),
axis.line = element_line(colour='black', linewidth = 3,
linetype=1),
axis.line.x.top = element_line(colour='black', linewidth = 1,
linetype=1),
axis.line.y.right = element_line(colour='black', linewidth = 1,
linetype=1),
plot.title = element_text(hjust = 0.5,size = 20,
face = 'bold',family = 'serif'),
axis.text = element_text(size=20,face='bold',
family = 'serif',color = 'black'),
legend.title=element_text(face='bold',family = 'serif',
size = 15),
legend.text = element_text(size = 15,
face='bold',
family='serif'),
panel.background = element_rect(fill=NA,color = 'black')
)
I met this situation. I checked these codes many times, but the problem seemed still occured.
And I have tried tidyterra package as well. The same problem.