无法打印到pdf ggplot图表 [英] Can't print to pdf ggplot charts

查看:106
本文介绍了无法打印到pdf ggplot图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

在R函数中生成多个图形

发生在我身上的非常奇怪的事情:下面的代码无法打印到pdf设备:

Very strange thing happening to me: the following code fails to print to pdf device:

outnames <- c("1.pdf", "2.pdf")
for (n in outnames){
    pdf(n)
    qplot(1:10)
    dev.off()
}

不会将任何东西打印为pdf,即使生成pdf文件。然而,

won't print anything to pdf, even though a pdf file is generated. However,

pdf(outnames[2])
qplot(1:10)
dev.off()

可以很好地工作。任何想法为什么?转载于R 2.11.1。

will work perfectly well. Any idea why? Reproduced in R 2.11.1.

推荐答案

Gappy,闻起来像 FAQ 7.22 - 所以请尝试 print(qplot(1:10))

Gappy, that smells like the FAQ 7.22 -- so please try print(qplot(1:10)).

这篇关于无法打印到pdf ggplot图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆