保存tiff问题 - R.

时间:2016-06-11 18:31:06

标签: r tiff

我有这部分剧本:

tiff(filename = "C:/nDesktop/Desktop/image/PCvsLD.tiff",  width =1200, height = 900,  pointsize = 12,  bg = "white", res = 96,   units = "px", restoreConsole = TRUE)
finP<-grid_arrange_shared_legend(plotA, plotB,plotC, plotD)
dev.off()

当我运行它时,我得到一个好的低分辨率96 DPI TIFF文件但是当我希望将DPI增加到500时,保存的图像不正确(例如,字体大小改变,缺少部分,部分重叠)。

我该如何解决?

grid_arrange_shared_legend函数:

#code used from http://rpubs.com/sjackman/grid_arrange_shared_legend
grid_arrange_shared_legend <- function(...) {
  plots <- list(...)
  g <- ggplotGrob(plots[[1]] + theme(legend.position="bottom"))$grobs
  legend <- g[[which(sapply(g, function(x) x$name) == "guide-box")]]
  lheight <- sum(legend$height)
  grid.arrange(
    do.call(arrangeGrob, lapply(plots, function(x)
      x + theme(legend.position="none"))),
    legend,
    ncol = 1,
    heights = unit.c(unit(1, "npc") - lheight, lheight))
}

0 个答案:

没有答案