title: R: Color overlaps in Venn diagram by size of overlap
body: <p>I think Venn diagrams are an extremly usefull way of comparing data. The problem is that as soon as I start having multiple (3 or more) classes the size of the circles can no longer indicate the size of the overlap.</p>
  
  <p>What I would like to do is to color each filed in the Venn diagram by the size of the overlap instead of the class label: </p>
  
  <p>For example when I draw a normal Venn diagram:</p>
  
  <pre><code>require(VennDiagram)
  # Make data
  oneName &lt;- function() paste(sample(LETTERS,5,replace=TRUE),collapse="")
  geneNames &lt;- replicate(1000, oneName())
  
  GroupA &lt;- sample(geneNames, 400, replace=FALSE)
  GroupB &lt;- sample(geneNames, 750, replace=FALSE)
  GroupC &lt;- sample(geneNames, 250, replace=FALSE)
  GroupD &lt;- sample(geneNames, 300, replace=FALSE)
  
  v1 &lt;- venn.diagram(list(A=GroupA, B=GroupB, C=GroupC, D=GroupD), filename=NULL, fill=rainbow(4))
  grid.newpage()
  grid.draw(v1)
  </code></pre>
  
  <p>It looks like this:
  <img src="https://i.stack.imgur.com/kBZNU.png" alt="Resulting Venn diagram"></p>
  
  <p>The resulting Venn diagram is divided into 15 separate fields each with its own color and number. The color of each separate field is determined by the color of the categories/groups indicated by the fill argument.</p>
  
  <p>What I want to do is instead to color each separate field using a color gradient indicating the size of the field so it will be visually easy to spot the largest/smallest groups (Similar to how the coloring of heatmaps / levelplots works)</p>
  
  <p>Is there a way of doing that in R?</p>