【问题标题】:Trying to save a graph in R, but the file is too big. Trying to shrink it试图在 R 中保存图形,但文件太大。试图缩小它
【发布时间】:2020-03-20 16:51:11
【问题描述】:

我需要将图表保存到 Word 文档中,以便将其提交给医学期刊。当我将我的图表粘贴到 Word 中时,分辨率不是很好,它说它可以缩放到原始大小的 22%。当我使用 R 代码保存它时,分辨率非常好。但是,当我保存它时,图像似乎很大。如果我在 word 中将比例更改为原始大小的 100%,它对于文档来说太大了(但很清楚)。

我正在使用下面的代码来保存它:

jpeg("filename.jpg", units="in", width=7, height=7, res=300)

CODE FOR PLOT

dev.off()

期刊要求至少 300dpi。问题可能是 7x7 太大了,因为当我将其缩小并将其插入 word 时,它非常清晰。但是,我无法将其缩小到低于 7x7 的任何尺寸,因为它会切断我的部分情节。

我该如何解决这种情况?我想缩小绘图,使其尺寸更小,而不会丢失任何分辨率并切断图表的任何部分。

【问题讨论】:

    标签: r plot graph save data-science


    【解决方案1】:

    我会以您满意的尺寸提交 300dpi 的图表,期刊将能够处理它。

    但是,如果您想更改高度等,我会执行以下操作:

    tiff("test.tiff", width = 2700, height = 1600, units = 'px', res = 300)
    plot(iris$Sepal.Length, iris$Petal.Length)
    dev.off()
    
    #OR different width height
    
    tiff("test2.tiff", width = 700, height = 1000, units = 'px', res = 300)
    plot(iris$Sepal.Length, iris$Petal.Length)
    dev.off()
    

    【讨论】:

      猜你喜欢
      • 2012-05-14
      • 1970-01-01
      • 1970-01-01
      • 2012-11-05
      • 2013-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多