R 对每个页面应用相同的多行文字

R 对每个页面应用相同的多行文字,r,histogram,R,Histogram,我在多个页面上有多个绘图,如何为所有页面提供相同的多行文字?下面是一个示例数据集: bootData <- lapply(seq(1,24), function(x) rnorm(50)) names(bootData) <- c("0", "2", "4", "6", "8", "10", "15", "20", "30", "40", "45", "50", "55", "60", "65", "70", "80", "85", "90", "92", "94", "96",

我在多个页面上有多个绘图,如何为所有页面提供相同的多行文字?下面是一个示例数据集:

bootData <- lapply(seq(1,24), function(x) rnorm(50))
names(bootData) <- c("0", "2", "4", "6", "8", "10", "15", "20", "30", "40", "45", 
"50", "55", "60", "65", "70", "80", "85", "90", "92", "94", "96", 
"98", "100")
我想多行文字“每个标签错误”出现在每一页。上面的代码只显示在最后一页


非常感谢。

您的
mtext
lappy
之外。将其包含在
lappy
调用中。
pdf(file = "test.pdf", width = 11.5, height = 8.5)
par(mar=c(5,4,3,2), oma=c(3,3,1,3), mfrow = c(2,3))
lapply(names(bootData), function(x){ 
hist(bootData[[x]], main = paste("Histogram of", x))
mtext("Error per label", side = 1, line = 1, outer = TRUE,  col = "firebrick")
})
dev.off()
pdf(file = "test.pdf", width = 11.5, height = 8.5)
par(mar=c(5,4,3,2), oma=c(3,3,1,3), mfrow = c(2,3))
lapply(names(bootData), function(x){ 
hist(bootData[[x]], main = paste("Histogram of", x))
mtext("Error per label", side = 1, line = 1, outer = TRUE,  col = "firebrick")
})
dev.off()