我正在尝试制作多个图的 pdf,但 pdf 只会打印前 n 个图。我正在使用 ggforce::facet_wrap_paginate。下面是我写的代码。如果有人对为什么我只得到前 6 个地块有任何建议,我会很高兴?我也尝试过使用 PNG,但我遇到了同样的问题。完成后,我期待 20-30 页(大约 160 个图)之间的 pdf。所以你可以理解我只有6个情节的挫败感......
pg <- ceiling(
length(levels(Tidy$Region)) / 6
)
pdf("attempt3001.pdf")
for(i in seq_len(pg)){
print(ggplot(Tidy, aes(x=Year, y=Value / 1000, group=Country, color=Status))+
geom_line()+
theme_classic()+
facet_wrap_paginate(~Region, nrow = 3, ncol = 2, page = 1, scales = "free"))
}
dev.off()
我在堆栈上看到过类似的问题,但它们是在 facet_wrap_paginate 出现之前(这太棒了!)或者没有解决我的问题。提前谢谢了。
这个问题是我模拟当前代码的问题。我希望我可以评论那个,但我没有声誉哈哈。