Hi list,

I found this one when I was trying to output the Venn diagram to a .pdf file.  
When there are 4 sets of groups to draw, the .pdf file automatically has 3 
pages and the figure only appears on the 3rd page in the .pdf file with the 
first 2 pages being blank.  Try the following: (I'm using R-2.9.0 on WinXP, 
gplots 2.7.1).  gplots 2.7.3 has the same problem.

###==========================
pdf("test.pdf")
A<- 1:20

B<- 1:20

C<- 2:20

D<- 3:21

input<-list(A,B,C,D)

venn(input)

dev.off()
###==========================

By looking at the code of "drawVennDiagram", I think the problem comes from the 
fact there are one grid.newpage() call and two plot function calls when 
numCircles==4 (see below).  I wonder the grid.newpage() and the second plot 
call are necessary?

Thanks a lot.

...Tao


##=========================================================================
........
    else if (4 <= numCircles && numCircles <= 5 && !simplify) {
        grid.newpage()                                     
<<<<<<<<<<<<<<<<===============================
        relocate_elp <- function(e, alpha, x, y) {
            phi = (alpha/180) * pi
            xr = e[, 1] * cos(phi) + e[, 2] * sin(phi)
            yr = -e[, 1] * sin(phi) + e[, 2] * cos(phi)
            xr = x + xr
            yr = y + yr
            return(cbind(xr, yr))
        }
        lab <- function(identifier, data, showLabel = showSetLogicLabel) {
            r <- data[identifier, 1]
            if (showLabel) {
                return(paste(identifier, r, sep = "\n"))
            }
            else {
                return(r)
            }
        }
        plot(c(0, 400), c(0, 400), type = "n", axes = F, ylab = "",   
<<<<<<<<<<<<<<============
            xlab = "")
        if (4 == numCircles) {
            elps = cbind(162 * cos(seq(0, 2 * pi, len = 1000)), 
                108 * sin(seq(0, 2 * pi, len = 1000)))
            plot(c(0, 400), c(0, 400), type = "n", axes = F,     
<<<<<<<<<<<<<<<<<<===============
                ylab = "", xlab = "")
            polygon(relocate_elp(elps, 45, 130, 170))
            polygon(relocate_elp(elps, 45, 200, 200))

...........
###===============================================================================

                                          
_________________________________________________________________
[[elided Hotmail spam]]

D24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:102009
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to