1
我在多個頁面上有多個圖表,我如何爲所有頁面提供相同的多行文字?下面是一個示例數據集:將相同的多行文字應用於每一頁
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")
圖中的數據
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()
我想多行文字「每個標籤的錯誤」出現在每一頁。使用上面的代碼它只會出現在最後一頁。
非常感謝提前。
你的'mtext'在'lapply'之外。將它包含在「lapply」調用中。 – infominer