I am looking for a Python library that is able to produce Venn diagrams. It should take as input two or three sets, and display a Venn diagram that represent the sets.

If possible:

  • the number of items in each set can displayed.
  • plots can be saved in some vectorial format.
  • plots can be displayed in black and white (for some antique publication requirements).

The Python package matplotlib-venn is great:

from matplotlib import pyplot as plt
from matplotlib_venn import venn3, venn3_circles
set1 = set(['A', 'B', 'C', 'D'])
set2 = set(['B', 'C', 'D', 'E'])
set3 = set(['C', 'D',' E', 'F', 'G'])

venn3([set1, set2, set3], ('Set1', 'Set2', 'Set3'))

enter image description here

But it currently has an issue that cause some sets to have a wrong count.

Related: JavaScript library to display Venn diagrams


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.