【问题标题】:cowplot plot_grid scales down size of plots automaticallycowplot plot_grid 自动缩小绘图的大小
【发布时间】:2019-02-25 10:26:09
【问题描述】:

我正在尝试使用cowplot 的函数plot_grid 来渲染一个包含一系列25 个图的pdf,这些图排列在6 列中。

我希望这些显示的大小与我只有一行时显示的大小相同。由于某些原因,尽管随着我添加新行,地块的大小会变小。有我不知道的解决方案吗?下面是两个结果的代码。非常感谢提前

仅 1 行 plot_grid:

cowplot::plot_grid(plot_emmeans_N_L, plot_emmeans_N_L,
plot_emmeans_N_L,plot_emmeans_N_L,plot_emmeans_N_L,
plot_emmeans_N_L,  nrow = 1, ncol=6, align = "v")

如下所示:

这是plot_grid 共 5 行的 25 个图:

cowplot::plot_grid(plot_emmeans_N_L, plot_emmeans_N_L,
plot_emmeans_N_L,plot_emmeans_N_L,plot_emmeans_N_L,
plot_emmeans_N_L,plot_emmeans_N_L, plot_emmeans_N_L,
plot_emmeans_N_L,plot_emmeans_N_L,plot_emmeans_N_L,
plot_emmeans_N_L,plot_emmeans_N_L, plot_emmeans_N_L,
plot_emmeans_N_L,plot_emmeans_N_L,plot_emmeans_N_L, 
plot_emmeans_N_L,plot_emmeans_N_L, plot_emmeans_N_L,
plot_emmeans_N_L,plot_emmeans_N_L,plot_emmeans_N_L,
plot_emmeans_N_L,plot_emmeans_N_L, 
NULL,NULL,NULL, NULL, NULL, nrow = 5, ncol=6, align = "v")

这反而变得更小了:

【问题讨论】:

  • 你说得对,对不起,我没有提到这一点,但我实际上是在尝试使用 Bookdown 库将其呈现为 .pdf 文档,我可以调整这些代码行中的任何一个吗(我认为他们在 Markdown 中与 knitr 一起工作)? ggsave("yourfilename.pdf", height = 20, width = 20, device = "pdf")save_plot("general.pdf", my_plot, ncol = 2, nrow = 2)

标签: r bookdown cowplot


【解决方案1】:

最终我最好的解决方案是使用拼凑库并(平庸地)添加块选项 fig.height= x, fig.width= y ,这是所有地块的大小,如 here 发布的那样

【讨论】:

    猜你喜欢
    • 2020-11-14
    • 1970-01-01
    • 2021-09-06
    • 2016-07-10
    • 1970-01-01
    • 2021-09-13
    • 2017-07-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多