【发布时间】:2020-07-15 07:43:11
【问题描述】:
我无法对齐两张地图。我在下面使用一个可重现的例子:
library(ggplot2)
library(cowplot)
world <- map_data("world")
pl2= ggplot() +
geom_polygon(data=world, aes(x=long, y=lat, group=group)) +
theme_bw()+
coord_equal()
pl1 <- ggplot() +
geom_polygon(data=world, aes(x=long, y=lat, group=group, color=group)) +
coord_equal()
plot_grid(pl2, pl1 + theme(legend.justification = c(0,1)), align="h",axis = "bt")
我尝试了各种方法,例如设置图形宽度和高度,尝试scale=,align="h",axis = "bt" 的各种选项
我还尝试了plot_grid(pl2, pl1+ theme(legend.position = "none"), align="h", scale=c(1,1)),然后再次添加legend legend <- get_legend(pl1) 和plot_grid。
当我使用 coord_equal 时,我也有大量的空白,我无法摆脱(我没有保存图表,只是显示它)
【问题讨论】:
标签: r dictionary ggplot2 cowplot