Question: Different colors in vennDiagram?
0
gravatar for Leif Väremo
6.1 years ago by
Leif Väremo70
Leif Väremo70 wrote:

Hi,

I am trying to use the vennDiagram function of the limma package to color the circle borders in different colors. This works fine for up to three circles, but for four and five circles I can not get it to work. Does anyone have a solution for this?

Below is some sample code to reproduce my issue (adapted from the example section of the vennDiagram function):

Y <- matrix(rnorm(100*6),100,6)
Y[1:10,3:4] <- Y[1:10,3:4]+3
Y[1:20,5:6] <- Y[1:20,5:6]+3
design <- cbind(1,c(0,0,1,1,0,0),c(0,0,0,0,1,1),c(1,0,1,0,1,0))
fit <- eBayes(lmFit(Y,design))
results <- decideTests(fit)
a <- vennCounts(results)
print(a)
mfrow.old <- par()$mfrow
par(mfrow=c(1,2))
vennDiagram(a,circle.col=c("red","green","blue","yellow"))

For me all circles are red, instead of red, green, blue and yellow.

Thanks!
/Leif

limma • 2.6k views
ADD COMMENTlink modified 4.7 years ago by Gordon Smyth37k • written 6.1 years ago by Leif Väremo70
Answer: Different colors in vennDiagram?
0
gravatar for Dan Du
6.1 years ago by
Dan Du210
Germany
Dan Du210 wrote:

Hi Leif,

A little dig in the vennDiagrm source code shows that, when there are 4 or 5 sets, all function calls to draw set with 'polygon' use only the first argument in circle.col, e.g.

polygon(relocate_elp(elps, 378, 145, 200), border = circle.col[1], lwd = lwd)

Some simple fork will do, just replacing those circle.col[1] with the right index.

Dan

ADD COMMENTlink modified 4.7 years ago by Gordon Smyth37k • written 6.1 years ago by Dan Du210
Answer: Different colors in vennDiagram?
0
gravatar for Gordon Smyth
4.7 years ago by
Gordon Smyth37k
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Gordon Smyth37k wrote:

This has since been fixed. In more recent versions of limma, your code will now give the correct result, i.e., four different colors for the 4 sets.

ADD COMMENTlink written 4.7 years ago by Gordon Smyth37k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 116 users visited in the last hour