0

I want to have two (or more) Venn diagrams in a ".eps" file. I used this post by fridaymeetssunday, which refers to this post by mnel, and I just changed the code from "pdf" to "eps" by postscript.

The problem is, when I run the code and open the file the diagrams are colorless and do not have any colors. Should I have done something else?

# 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()
Community
  • 1
  • 1
hora
  • 845
  • 5
  • 14
  • 25
  • I've added the rest of the code, please check if it is correct. – Ferdinand.kraft Aug 04 '13 at 00:27
  • Well, start simple. Try something as plain as `plot(1:10,col='red')` inside your `postscript` and `dev.off` statements and see what you get. At the same time, take any color image in some other application (like maybe powerpoint) and print or save to an eps file, just to make sure whatever operating system you've got is supporting color in eps. And BTW, what application are you opening the .eps files in -- does it support color? – Carl Witthoft Aug 04 '13 at 11:36

0 Answers0