【发布时间】:2021-11-18 03:24:44
【问题描述】:
我试图在使用 ggplot 创建的地图上重叠 shp 层,当我绘制两个独立的图时,你建议我如何重叠两个层?
data.shape<-readOGR(dsn="departamentos",layer="DEPARTAMENTOS")
ggplot()+
geom_tile(data = tx_trend, aes(x = longitude, y = latitude, fill = slope))+
scale_fill_gradientn(colors = rev(pals::linearlhot(100)), name = "ºC/10y", limits = c(0.1,0.5)) +
#scale_fill_gradientn(colors = (pals::isol(100)), name = "ºC/10y", limits = c(0.1,0.45)) +
# geom_point(data = filter(tx_trend, sign < 0.01),aes(x = longitude, y = latitude, color = "Sign. trend \n p-value <0.01"),
geom_point(data = filter(tx_trend, sign < 0.01),aes(x = longitude, y = latitude, color = "Sign. trend \n p-value <0.01"),
size = 0.7, show.legend = T) +
scale_color_manual(values = c("black"), name = "")+
coord_fixed(1.3)+
xlab("Longitude") + ylab("Latitude")+
labs(title = "Decadal trend Summer",
subtitle = "(1981-2016)",
caption = "")+
theme_bw() +
guides(fill = guide_colourbar(barwidth = 9, barheight = 0.5, title.position="right"))+
theme(legend.position = "bottom")
【问题讨论】:
-
据我所知,这里只有两个美学:
geom_tile和geom_point都显示在第一个情节中。 -
他们在两个不同的地块。
标签: r ggplot2 overlap shapefile rgdal