For the past few days I have been trying to figure out how to draw a Venn diagram from an arbitrary number of sets and came across the R
package venneuler
. This code:
genes <- paste("gene",1:20,sep="")
df = data.frame(term=character(), class=character(), stringsAsFactors = FALSE)
for (k in 1:15) {
df2=data.frame(term=sample(genes,10), class = rep(paste("class ",k,sep=""),10), stringsAsFactors =
FALSE)
df<-rbind(df,df2)
}
library(rJava)
library(UpSetR)
library(tidyverse)
library(venneuler)
library(grid)
v <- venneuler(df)
par(cex = 0.5)
plot(v)
produces a figure like this:
This figure was just what I was looking for. Anyway, I would like to remove the name of the set (class 1, class 2 etc.) from the plot, and instead add the elements (e.g. gene1, gene2) contained within each set.