英文:
Saving an extremely long figure as pdf in R will cause all text invisible
问题
R 4.2.1
包使用: netmeta 2.8-1
问题:
在netmeta
包中,函数forest()
会创建一个森林图。需要知道forest()
可以生成一个展示直接和间接比较之间网络不一致性的森林图。
在我的情况下,我有一个非常庞大的网络,将导致超过2000个比较。描述网络不一致性的森林图在高度上会非常长。
以下脚本只能创建“部分”森林,因为森林太长。
pdf("filename.pdf", width = 12, height = 200)
forest(out, show = "all")
dev.off()
我尝试增加高度以包含此文档中的所有内容。但是高度超过200的任何值都会生成一个“空白”的pdf(但我认为文本应该在那里,因为文件大小为240KB,而不是一个只占据我磁盘4KB的空文件)。
我不知道如何使pdf中的文本可见并同时保留文件中的所有内容。任何建议将不胜感激。谢谢。
英文:
R 4.2.1
package usage: netmeta 2.8-1
Issue:
In netmeta
package, the function forest()
will create a forest plot. One need to know that forest()
can generate a forest plot presenting the network inconsistency between direct and indirect comparisons.
In my case, I have an extremely large network, which will lead to more than 2000 comparisons. The forest plot describing network inconsistency will be VERY long in height.
The following script can only create "part" of the forest because the forest is too long.
pdf("filename.pdf",width = 12, height = 200)
forest(out, show = "all")
dev.off()
I tried to increase the height to make all the content in this document. But any value above 200 in height will generate a "blank" pdf (but I think the text should be there because the file size is 240KB rather than a NULL file which only takes 4KB in my disk).
I have no idea how to make the text visible in pdf and keep all content in this file at the same time. Any suggestion will be appreciated. Thank you.
答案1
得分: 1
PDF 1.x对页面大小有一个实施限制:
>默认用户空间中的最小页面大小应为3乘3个单位;最大页面大小应为14,400乘14,400个单位。在PDF 1.6之前的PDF版本中,默认用户空间单位的大小固定为1/72英寸,最小值约为0.04乘0.04英寸,最大值为200乘200英寸。从PDF 1.6开始,可以根据页面设置单位的大小;默认值仍为1/72英寸。
(ISO 32000-1,附录C.2 架构限制)
如果R在大width
或height
参数的情况下不调整默认的用户空间单位大小,那么当您将其中一个参数设置为大于200的值时,它将生成超出这些限制的PDF文件。
由于这些限制源自PDF规范的Adobe实现,即Adobe Acrobat,因此使用Adobe软件进行测试可能确实会显示问题...
英文:
PDF 1.x has an implementation limit for the page size:
>The minimum page size should be 3 by 3 units in default user space; the maximum should be 14,400 by 14,400 units. In versions of PDF earlier than 1.6, the size of the default user space unit was fixed at 1⁄72 inch, yielding a minimum of approximately 0.04 by 0.04 inch and a maximum of 200 by 200 inches. Beginning with PDF 1.6, the size of the unit may be set on a page-by-page basis; the default remains at 1/72 inch.
(ISO 32000-1, Annex C.2 Architectural limits)
If R doesn't adjust the default user space unit size in case of large width
or height
arguments, it generates PDFs that go beyond these limits whenever you set either argument to a value greater than 200.
As those limits originate from the Adobe implementation of the PDF spec, i.e. Adobe Acrobat, tests with Adobe software may indeed show issues...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论