Different colors in vennDiagram?
2
0
Entering edit mode
Leif Väremo ▴ 70
@leif-varemo-5898
Last seen 8.4 years ago

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 • 4.7k views
ADD COMMENT
0
Entering edit mode
Dan Du ▴ 210
@dan-du-5270
Last seen 3 months ago
Germany

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 COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 3 hours ago
WEHI, Melbourne, Australia

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 COMMENT

Login before adding your answer.

Traffic: 695 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6