【问题标题】:Using library(VennDiagram) to save an .EPS file?使用库(VennDiagram)保存 .EPS 文件?
【发布时间】:2017-07-22 18:41:24
【问题描述】:

我使用以下代码生成 EPS

venn.plot = draw.triple.venn( area1=leftLen, area2=rightLen, area3=midLen, n12=(left_rightLen+allIntersectLen), n23=(right_midLen+allIntersectLen), n13=(left_midLen+allIntersectLen), n123=allIntersectLen, category = c("Left Leaning", "Right Leaning", "Central"), lty="blank", fill = c("blue", "red", "purple") )

如何将其保存为 EPS 文件?我试过做

setEPS()
postscript( filePathForEpsFile )
plot( venn.plot )

我得到一个错误。我应该如何将其保存为 EPS 文件?

【问题讨论】:

    标签: r eps venn-diagram


    【解决方案1】:

    我可能不同意这个答案,因为您没有提供可重复的示例;至少,你的 venn.plot 代码给了我这个:

    Error in draw.triple.venn(area1 = leftLen, area2 = rightLen, area3 = midLen,  : 
      object 'leftLen' not found
    

    您也没有向我们提供您遇到的错误。

    但是,看看您如何称呼您的 venn.plot,我认为这可能是问题所在。如果您查看 VennDiagram reference manual,您会发现您不需要(或者不应该?)使用 plot() 来绘制图表。他们使用 grid.draw()。

    所以,在他们手册中的一个简单示例中尝试一下:

    library(VennDiagram)
    venn.plot <- draw.pairwise.venn(100, 70, 30, c("First", "Second"))
    plot(venn.plot)
    

    这段代码给了我以下错误。

    Error in xy.coords(x, y, xlabel, ylabel, log) : 
      'x' is a list, but does not have components 'x' and 'y'
    

    这就是你所说的错误吗?

    下面的代码

    grid.draw(venn.plot)
    

    很好地绘制了你的维恩图。

    他们经常在上面抹去

    grid.newpage()
    

    避免在 venn 上绘制 venn。

    将维恩图保存为 EPS 然后简单地归结为:

    setEPS()
    postscript(file = "ExampleVenn.EPS", fonts = "serif")
    grid.draw(venn.plot)
    dev.off()
    

    我在 postscript 调用中添加了 fonts = "serif" 以避免出现错误提示

    Error in grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  : 
      family 'serif' not included in postscript() device 
    

    当您收到此错误时,图表中的标签不会保存到 EPS 文件中。
    我希望这有助于解决您的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-17
      • 1970-01-01
      • 1970-01-01
      • 2019-02-01
      相关资源
      最近更新 更多