R中一个“.EPS”文件中的多个维恩图

时间:2013-08-03 22:50:05

标签: r eps venn-diagram

我希望在“.eps”文件中有两个(或更多)维恩图。我使用了this post by fridaymeetssunday,它引用了this post by mnel,我只是通过postscript将代码从“pdf”更改为“eps”。

问题是,当我运行代码并打开文件时,图表是无色的,没有任何颜色。我应该做些别的吗?

# libraries
library(VennDiagram)
library(grid)
library(gridBase)
library(lattice)

# create the diagrams
temp1 <- venn.diagram(list(B = 1:1800, A = 1571:2020),
    fill = c("red", "green"), alpha = c(0.5, 0.5), cex = 1,cat.fontface = 2,
    lty =2, filename = NULL)
temp2 <- venn.diagram(list(A = 1:1800, B = 1571:2020),
    fill = c("red", "green"), alpha = c(0.5, 0.5), cex = 1,cat.fontface = 2,
    lty =2, filename = NULL)    

# start new page
plot.new() 
#pdf("testpdf", width = 14, height = 7)

postscript("test.eps", height=8, width=8, paper="special", family="Helvetica", fonts=c("serif","Helvetica"), horizontal=FALSE)
# setup layout
gl <- grid.layout(nrow=1, ncol=2)
# grid.show.layout(gl)

# setup viewports
vp.1 <- viewport(layout.pos.col=1, layout.pos.row=1) 
vp.2 <- viewport(layout.pos.col=2, layout.pos.row=1) 

# init layout
pushViewport(viewport(layout=gl))
# access the first position
pushViewport(vp.1)

# start new base graphics in first viewport
par(new=TRUE, fig=gridFIG())

grid.draw(temp2)

# done with the first viewport
popViewport()

# move to the next viewport
pushViewport(vp.2)

grid.draw(temp2)

# done with this viewport
popViewport(1)

dev.off()

0 个答案:

没有答案