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')
4

0 回答 0