patchwork 'ncol' Error: Theme element `ncol` is not defined in the element hierarchy

patchwork 'ncol' Error: Theme element `ncol` is not defined in the element hierarchy

我正在尝试用 patchwork 绘制 6 ggplot 对象,以便在每一行中绘制 3 ggplot 对象。根据 运行 下面的代码; 运行 Final.Plot 时出现错误。这怎么能解决?顺便说一句,对象 patchwork 按预期独立工作。

patchwork = (ggplot1+ ggplot2 + ggplot3) / (ggplot4 + ggplot5 + ggplot6) 
Final.Plot = patchwork + 
  plot_annotation(tag_levels = 'A')  & theme(legend.position = "bottom") +
  plot_layout(guides = "collect") 

错误

'ncol'  Error: Theme element `ncol` is not defined in the element hierarchy.

运行成同样的问题。结果证明顺序很重要。我通过在 plot_annotation().

之前放置 plot_layout() 来让它工作
patchwork = (ggplot1+ ggplot2 + ggplot3) / (ggplot4 + ggplot5 + ggplot6) 
Final.Plot = patchwork + 
  plot_layout(guides = "collect") +
  plot_annotation(tag_levels = 'A')  & theme(legend.position = "bottom")