【发布时间】:2018-04-05 05:17:29
【问题描述】:
这是一个微不足道的问题,但我仍然想解决这个问题。我正在使用marrangeGrob 和ggsave 导出一系列图表。我想将使用marrangeGrob 生成的页码的默认位置更改为从页面顶部到右下角。
基于这个问题; Remove page numbers from marrangeGrob (or arrangeList) pdf,我可以包含参数top = NULL, bottom = quote(paste("page", g, "of", pages)) 将页码移到每页的底部,但页码仍然在中间。
我可以在paste 语句的开头添加很多空间,因此:" page" 但这看起来真的很难看。有没有更好的方法来做到这一点?
样本数据
library(ggplot2)
library(gridExtra)
# Create some plots
p1 <- qplot(mpg, wt, data = mtcars, colour = cyl)
p2 <- qplot(mpg, data = mtcars) + ggtitle("title")
p3 <- qplot(mpg, data = mtcars, geom = "dotplot")
# Combine into a list, and change where page numbers will appear
Export <- marrangeGrob(list(p1, p2, p3), nrow = 2, ncol = 1, top = NULL,
bottom = quote(paste("page", g, "of", npages)))
# Export to a pdf file
ggsave(filename = "multipage.pdf", Export, width = 7, height = 10, units = "in")
【问题讨论】: