在通过ggplot2 + ggExtra + cowplot组合图形时,我找不到不绘制外部框架的方法。我不知道该在哪里告诉R,但我怀疑问题出在ggExtra。下面是一个示例:
require(ggplot2)
require(cowplot)
require(ggExtra)
# Creat a graph
A <- ggplot(mpg, aes(x = cty, y = hwy, colour = factor(cyl))) + geom_point(size = 2.5)
# Add marginal histogram
B <- ggExtra::ggMarginal(A,type = 'histogram', margins = 'x', size = 9)
# Combine through cowplot
combo <- plot_grid(B,B,labels=c("A","B"))
plot(combo) # looks fine
# Re-combine through cowplot
plot_grid(B,combo,ncol=1,rel_heights = c(2,3)) # that's where I got an unwanted nasty frame around 'combo'

任何提示都将不胜感激!
发布于 2018-04-26 13:53:14
p <- plot_grid(B,combo,ncol=1,rel_heights = c(2,3))
p <- p + panel_border(remove = TRUE)https://stackoverflow.com/questions/43900867
复制相似问题