1

I'd like to add a legend to my Venneuler ven diagram based upon the generated colors in the diagram. How can i generate a corresponding legend? Is it also possible to plot the values in the Ven?

List1 <- c("102","148","211","293","296","405")
List2 <- c("102","148")

Lists <- list(List1,List2)
items <- sort(unique(unlist(Lists)))
MAT <- matrix(rep(0,length(items)*length(Lists)), ncol=3)
colnames(MAT) <- c("A","B")
rownames(MAT) <- items
lapply(seq_along(Lists), function(i){

    MAT[items %in% Lists[[i]],i] <<- table(Lists[[i]])
})

MAT

library(venneuler)

v <- venneuler(MAT > 0)

plot(v,main='R simple plot')
Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
Thomas
  • 523
  • 1
  • 5
  • 14
  • 2
    See here for a start: http://stackoverflow.com/questions/9121956/legend-venn-diagram-in-venneuler/9122099#9122099 – Josh O'Brien May 14 '13 at 12:43
  • Your code is not reproducible: You have 3 columns in `MAT` and are assigning the `colnames` with a vector of length 2.. – user1981275 May 14 '13 at 12:53

0 Answers0