我正在创建一张包含两层的 map -一张包含生物群落数据的热图(geom_tile),并在顶部分层不同区域的 map .我列出了每个地区的国家列表,我让R来显示一张 map ,其中仅显示不同 colored颜色 的地区的外边界.但是--因为边界是共享的,所以它们只显示一种 colored颜色 ,使得某些区域很难看到.有没有办法让两种 colored颜色 在边界都可见?
注意:我有自己的国家和次地区列表,这里不容易列出,所以我使用的是数据固有的一个
这是 map :
library(rnaturalearthdata)
library(dplyr)
library(ggplot2)
library(sf)
data1<-ne_countries(scale=50)
crs_target<-st_crs ("+proj=moll +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84")
data2<-data1%>%
sf::st_transform(crs=crs_target)
africa<-subset(data2,continent=='Africa')
westA<-africa%>%
group_by(region_wb)%>%
summarise()
ggplot()+
#geom_tile(data=test_cou,aes(x=x,y=y,fill=Biome))+ #My biome data- not relavant
geom_sf(data=westA,fill=NA,aes(colour=region_wb),linewidth=1.1)+
scale_color_manual(values=c('chocolate3','red3','purple3','maroon3','blue3'))+
#scale_fill_manual(values=viridis(12))+
guides(color=guide_legend(position='bottom',direction='horizontal')
)
这是我当前的 map -你可以看到红色区域(中非)很难看到,因为旁边是蓝色和紫色.有什么 idea 吗? enter image description here