我绘制了世界栅格并使用了borders
世界形状轮廓。轴承海峡以西的Russion半岛的一部分被分割并从地图的左边缘开始,但是形状轮廓是连续的。如何在空缺形状框中填充/移动这些栅格点?还是borders
在180°E分裂的世界形状与栅格重合?
ras <- raster('ras_file')
ras_mtx <- rasterToPoints(ras)
ras_df <- as.data.frame(ras_mtx)
colnames(ras_df) <- c('lon','lat','val')
map_theme <- theme(text=element_text(family='calibri'),
plot.title=element_text(hjust=0.5),
plot.background=element_rect(fill='transparent', colour='transparent'),
panel.background=element_rect(fill='transparent', colour='gray'),
panel.border=element_rect(fill='transparent', colour='black'),
panel.grid.major=element_line(),
panel.grid.minor=element_line(),
axis.text=element_text(color='black'),
strip.background=element_rect(fill='transparent', colour='transparent'),
panel.spacing.x=unit(4,'mm'),
legend.box.background=element_rect(fill='transparent', colour='transparent'),
legend.key=element_rect(fill='transparent', colour='transparent'),
legend.justification = c("right", "top"))
map_fill <- scale_fill_distiller(palette='Spectral')
bm <- ggplot()+
geom_raster(data=ras_df,aes(x=lon,y=lat,fill=val))+
map_fill+
scale_x_continuous(breaks=seq(-180,180,60),label=paste0(seq(-180,180,60),'°'))+
scale_y_continuous(breaks=seq(-60,90,20),label=paste0(seq(-60,90,20),'°'))+
borders('world',xlim=range(ras_df$lon),ylim=range(ras_df$lat),colour='black')+
labs(x='',y='')+
map_theme+
coord_fixed()