R 有没有办法调整cowplot对象的主题?
我可以改变组合情节的主题吗 例如:R 有没有办法调整cowplot对象的主题?,r,ggplot2,cowplot,R,Ggplot2,Cowplot,我可以改变组合情节的主题吗 例如: library(ggplot2) library(cowplot) p1 = ggplot(diamonds, aes(x = price)) + geom_histogram(bins = 30) p2 = ggplot(diamonds, aes(x = table)) + geom_histogram(bins = 30) p = cowplot::plot_grid(p1,p2) 这项工作: p1 + theme_bw() 这不起作用: p + t
library(ggplot2)
library(cowplot)
p1 = ggplot(diamonds, aes(x = price)) + geom_histogram(bins = 30)
p2 = ggplot(diamonds, aes(x = table)) + geom_histogram(bins = 30)
p = cowplot::plot_grid(p1,p2)
这项工作:
p1 + theme_bw()
这不起作用:
p + theme_bw()
简单的回答是“不”
您在cowplot中看到的绘图已渲染为Grob。它们没有可以更改的主题元素。从理论上讲,你可以“接触”到p结构中隐藏的grob,并一次一个地改变单个grob,但这是困难的、混乱的和不可靠的
作为一个显示这有多棘手的练习,下面是如何将p
更改为主题\u bw
外观:
p
p$layers