【问题标题】:Cannot disable R markdown output from gridExtra (additional cases)无法从 gridExtra 禁用 R 降价输出(其他情况)
【发布时间】:2018-09-26 16:03:45
【问题描述】:

当我编织时

```{r DATASNAPSHOT1, echo = FALSE, message=FALSE, warning=FALSE, fig.height=10, fig.width=10}
    plot1 <- grid.arrange(arrangeGrob(p0, p1,ncol=2), p2, ncol=1, heights=c(1.5,2))
    plot1
'''

到 R markdown (html),绘图按预期显示,但在它下面我得到了不需要的

## TableGrob (2 x 1) "arrange": 2 grobs
##   z     cells    name            grob
## 1 1 (1-1,1-1) arrange gtable[arrange]
## 2 2 (2-2,1-1) arrange  gtable[layout]

在我的输出中。

如果它在我的 r markdown 中,我该如何摆脱它?

我看过这个答案Cannot disable R markdown output from gridExtra (additional comment) 但在我的情况下它不起作用。

我试过了”

plot1 <- grid.arrange(arrangeGrob(p0, p1,ncol=2), p2, ncol=1, heights=c(1.5,2))
grid.draw(plot1)

plot1 <- arrangeGrob(arrangeGrob(p0, p1,ncol=2), p2, ncol=1, heights=c(1.5,2))
grid.draw(plot1)

plot1 <- arrangeGrob(p0, p1,ncol=2)
plot2 <- arrangeGrob(p2, ncol=1)
grid.draw(plot1, plot2, heights=c(1.5,2))

但没有任何作用。

【问题讨论】:

  • @Imo:我有 - 将其添加到 question.thx
  • 你真的需要grid.arrange吗?你可以试试cowplot::plot_gridegg::ggarrange看看是否有效

标签: r plot ggplot2 r-markdown gridextra


【解决方案1】:

plot1 被打印;如果您不想看到它被打印出来,请将其从块中删除。

【讨论】:

    猜你喜欢
    • 2017-01-09
    • 2016-07-25
    • 1970-01-01
    • 2018-04-05
    • 1970-01-01
    • 2013-12-30
    • 2015-04-14
    • 2019-02-12
    • 1970-01-01
    相关资源
    最近更新 更多