zoukankan      html  css  js  c++  java
  • [R] venn.diagram保存pdf格式文件?

    vennDiagram包中的主函数绘图时,好像不直接支持PDF格式文件:

    dat = list(a = group_out[[1]][,1],b = group_out[[2]][,1])
    names(dat) <- group_names[1:2]
    
    venn.plot <- venn.diagram(
      dat,
      filename = "proteinGroup_venn.tiff", #pdf error
      imagetype = "tiff",  #pdf error
      lwd = 3,
      col = "transparent",
      fill = c("cornflowerblue", "darkorchid1"),
      alpha = 0.6,
      label.col = "black",
      cex = 1.5,
      fontfamily = "serif",
      fontface = "bold",
      cat.col = c("cornflowerblue", "darkorchid1"),
      cat.cex = 2,
      cat.fontfamily = "serif",
      cat.fontface = "bold",
      margin = 0.05,
      cat.dist = c(0.03, 0.03),
      cat.pos = c(-20, 20)
    )
    

    直接使用pdf保存矢量图时不行,只能用tiff等其他矢量图格式。但在函数外结合grid.draw可以保存:

    venn.plot <- venn.diagram(
      dat,
      filename = NULL, #设为空
      lwd = 3,
      col = "transparent",
      fill = c("cornflowerblue", "darkorchid1"),
      alpha = 0.6,
      label.col = "black",
      cex = 1.5,
      fontfamily = "serif",
      fontface = "bold",
      cat.col = c("cornflowerblue", "darkorchid1"),
      cat.cex = 2,
      cat.fontfamily = "serif",
      cat.fontface = "bold",
      margin = 0.05,
      cat.dist = c(0.03, 0.03),
      cat.pos = c(-20, 20)
    )
    
    pdf(file="proteinGroup_venn.pdf")
    grid.draw(venn.plot)
    dev.off()
    

    如果不行,先安装加载library(grDevices)包。图如下:
    image.png

    Ref:https://stackoverflow.com/questions/14243609/problems-with-venndiagram

  • 相关阅读:
    MySQL(错误1064)
    如何判断是手机还是电脑访问网站
    Oracle表分区
    分离Date数据
    多对多
    一对多
    SQLalchemy基础
    paramiko上传下载
    paramiko
    automap
  • 原文地址:https://www.cnblogs.com/jessepeng/p/11610055.html
Copyright © 2011-2022 走看看