简体   繁体   English

使用 ggsave 设置图像分辨率

[英]Setting image resolution with ggsave

I found myself confused by ggsave not accepting the res argument.我发现自己对 ggsave 不接受 res 参数感到困惑。

ggplot()
ggsave("p.png", res = 300)

Error in grDevices::png(..., res = dpi, units = "in"): formal argument "res" matched by multiple actual arguments grDevices::png(..., res = dpi, units = "in") 中的错误:由多个实际 arguments 匹配的形式参数“res”

Luckily, user Roland's comment in this thread helped.幸运的是,用户 Roland 在此线程中的评论有所帮助。 I decided to ask a new question because editing the former to the core of the problem seemed more work.我决定提出一个新问题,因为将前者编辑到问题的核心似乎更多工作。

A closer look into?ggsave might have helped too.仔细研究?ggsave 可能也有帮助。

Weirdly, and I find very confusingly, ggsave seems to have a different name for the "res" argument in grDevices::<device>奇怪的是,我发现非常令人困惑,ggsave 似乎对grDevices::<device>中的“res”参数有不同的名称

use ggsave(dpi =...) , if you want to change grDevices::<device>(res =...)使用ggsave(dpi =...) ,如果你想改变grDevices::<device>(res =...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM