问题描述
是否可以使用 ggsave
压缩图形的文件大小?我尝试使用 compression = lzw
参数,但是文件大小保持不变。 (使用R Studio .98.501 OS-X Yosemite)
Is it possible to compress the file size of a figure using ggsave
? I have tried using the compression = "lzw"
argument, but the file size remains the same. (Using R studio .98.501 OS-X Yosemite)
我的代码:
ggsave("Figure1.tiff", width = 14, height = 8, dpi=600, compression = "lzw")
是否可以使用ggsave添加压缩参数?
Is it possible to add a compression argument with ggsave?
推荐答案
更新:
我刚刚尝试了此选项使用 ggplot2 2.2.1 。如果您使用以。tiff
结尾的文件进行保存,并指定 compression = lzw
,(与@Derelict 完全相同),ggsave现在将适当压缩图像。我的空间从2.98 MB增至37.6 KB。
I just tried this option with ggplot2 2.2.1. If you save using the file ending ".tiff"
, and specify compression = "lzw"
, (exactly as written by @Derelict), ggsave will now compress your image appropriately. Mine went from 2.98 MB to 37.6 KB.
这篇关于ggplot2的文件压缩选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!