[R] Save Venn-diagram (Vennerable) together with table and plot in single pdf page

Sonja Braaker sonja.braaker at wsl.ch
Fri Dec 2 14:39:22 CET 2011


Dear R-users

I want to save a list with characters a point plot and a Venn diagram in 
a single pdf page.

I am successful to do this when I use a character list and two point plots.
However when I try to replace the first point plots with my Venn diagram 
(built with Vennerable package, compute.Venn() and plot.Venn()) the Venn 
plot will not position at the right place in the pdf.

I guess there are some parameters in the plot.Venn function, that I need 
to change but I did not find out which ones.

Here an example of the pdf with two point plots as I want it:

library(gplots)
library(Vennerable)

Varnames<-c("A","B","C")
x <- Venn(SetNames = Varnames,Weight = 
c(`100`=2,`010`=6,`001`=10,`110`=1, `011`=0.2, `101`=0.5,`111`=1))
cx<-compute.Venn(x,doWeights = TRUE)
tabletext<-paste("Variable: ",letters[1:8],sep="")

pdf("path/plot_test.pdf", fillOddEven=TRUE,paper="a4", 
onefile=TRUE,width=7,height=10)
layout(matrix(c(1,2,2,1,2,2,3,3,3), 3, 3, byrow = TRUE),heights=c(1,1,2))
par(mar=c(6,2,2,4))
textplot(tabletext,valign="top",halign="left",cex=2)
plot(rnorm(100),main="Random 1")
plot(rnorm(100),col="red",main="Random2")
dev.off()


And here the example of the pdf with where I try to replace the 
"Random1" point plot with a Venn diagram (wrong size and position of 
Venn diagram):

pdf("path/venn_test.pdf", fillOddEven=TRUE,paper="a4", 
onefile=TRUE,width=7,height=10)
layout(matrix(c(1,2,2,1,2,2,3,3,3), 3, 3, byrow = TRUE),heights=c(1,1,2))
par(mar=c(6,2,2,4))
textplot(tabletext,valign="top",halign="left",cex=2)
plot(cx)
plot(rnorm(100),col="red",main="Random2")
dev.off()

Would be thankful for any hints

Sonja

-- 
Sonja Braaker
Swiss Federal Research Institute WSL
Community Ecology
Zürcherstrasse 111
CH-8903 Birmensdorf

Tel. +41 44 7392 230
Fax  +41 44 7392 215
sonja.braaker at wsl.ch
http://www.wsl.ch/info/mitarbeitende/braaker/index_EN



More information about the R-help mailing list