Is there a way to force overlap of two circles?

2019-08-17 14:59发布

问题:

I would like to draw a Venn Diagram really close to what the R Limma Package does.

In this case I have a set that does not overlap the two others. R package shows that with "0", but matplolib-venn draws another circle.

edit:

My 3 sets are:

  • 9
  • 7 8 9 10
  • 1 2 3 4 5 6

My code is:

set2 = set([9])
set1 = set([7, 8, 9, 10])
set3 = set([1, 2, 3, 4, 5, 6])

sets = [set1, set2, set3]
lengths = [len(one_set) for one_set in sets]

venn3([set1, set2, set3], ["Group (Total {})".format(length) for (length) in lengths]) 

Thank you.

R Limma: https://i.ibb.co/h9yhgm1/2019-05-07-Screen-Hunter-06.jpg

matplotlib_venn: https://i.ibb.co/zx6YJbz/2019-05-07-Screen-Hunter-07.jpg

Fred

回答1:

There is no element that is common to set3 and either set1 or set2. Both diagrams are correct. If you want to show all the spaces, you can try with venn3_unweighted:

from matplotlib_venn import venn3_unweighted

set2 = set([9])
set1 = set([7, 8, 9, 10])
set3 = set([1, 2, 3, 4, 5, 6])

sets = [set1, set2, set3]
lengths = [len(one_set) for one_set in sets]

venn3_unweighted([set1, set2, set3], ["Group (Total {})".format(length) for (length) in lengths])

And the result: