0

I am experimenting a strange problem using the python venn3 function from matplotlib_venn

The 111 patch has value None even if 2 elements are in it.

As the patch is not defined this is the result I'm getting:

enter image description here

As you can see the number is correct but the circles are not.

The elements composing the sets are str, each string is two words with a space between. The 111 is composed of 'expert revision', 'stakeholder mapping'

If anyone has an idea of what can cause this problem...

Here is a small example to reproduce this:

from matplotlib_venn import venn3
from matplotlib import pyplot as plt

A = {'tourism product', 'stakeholder mapping', 'vegetable group', 'cash credit', 'forestry research', 'vegetable supply', 'project workshop', 'development center', 'nature plants', 'marketing practices', 'ecology transition', 'water rice', 'expert revision', 'lakh tons', 'group fund', 'ayeyarwady region', 'frog production', 'customer engagement', 'work package', 'br ief', 'cashew nuts', 'ring test', 'rice area', 'certification pilot', 'agriculture market'}

B = {'monsoon rice', 'id imgres', 'month banana', 'crop selection', 'vegetable production', 'crop stage', 'soil losses', 'project review', 'pest problems', 'production limits', 'extension model', 'expert revision', 'sea agricultures', 'cdca dca', 'extension staff', 'staphylococcus aureus', 'disease problems', 'relay crops', 'update study', 'support village', 'project update', 'study villages', 'material cost', 'pasture land', 'research collaboration'}

C = {'stakeholder mapping', 'rice farmers', 'tree species', 'risk perception', 'calao project', 'plant development', 'climate resilience', 'field guide', 'agroecology practices', 'impact evaluations', 'paddy rice', 'forest areas', 'expert revision', 'engineering rice', 'school garden', 'farmer field', 'task leader', 'family farming', 'pesticide risk', 'adaptation strategies', 'note series', 'forestry administration',
'farming land', 'water infrastructures', 'potato plants'}

sets = [A, B, C]

plt.figure(figsize=(6,6))
v = venn3(sets)

print(v.get_patch_by_id('111'))
print("intersection :", A.intersection(B).intersection(C))

plt.show()
James Z
  • 12,209
  • 10
  • 24
  • 44
Clement M
  • 1
  • 1
  • Would it be possible to create example code, including test data (preferably a short example that reproduces the problem)? Don't forget to `import` the libraries used. – JohanC Jun 29 '21 at 09:16
  • @JohanC Of course, I have just added an exemple with some datas – Clement M Jun 29 '21 at 12:00
  • `venn3` tries to get the area of the 7 regions in proportion to the number of elements in each region. When there is a large imbalance, the central region might get eliminated. You could use `venn3_unweighted`, which doesn't resize depending on number of elements. – JohanC Jun 29 '21 at 14:39

0 Answers0