问题描述
我在MacBook Pro的ggplot2中生成了一个32x32(平铺,每个瓦片小于四分之一英寸x一个四分之一英寸的大小)热图,这是相对简单的东西.但是,此操作的pdf输出非常大(大约7MB),当我将其加载到pdflatex中时,文档中的加载和更改页面变得非常缓慢.我有什么选择?是否有更好的方法将R中的PDF保存为与ggplot2和pdflatex很好地兼容?
I'm generating a 32x32 (tiles, each tile less than a quarter inch x a quater inch size) heatmap in ggplot2 in my MacBook Pro, this is relatively simple stuff. However, the pdf output for this is huge (something like 7MB) and when I load it in pdflatex, loading and changing pages in the document becomes very slow. What are my options? Is there a better way to save a PDF in R that plays nicely with ggplot2 and pdflatex?
推荐答案
太大的常见PDF来源是在保存时指定尺寸,认为您使用的是像素,而实际上默认值是英寸.
A common source of PDFs that are way too big is specifying dimensions when saving, thinking you're working in pixels, when in fact the default is in inches.
尝试更改单位(在ggsave
中)或大小在pdf
中.
Try changing either the units (in ggsave
) or the sizes in pdf
.
这篇关于ggplot2/R输出pdf太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!