matplotlib_venn: Unable to plot venn graph for some values

404 Views Asked by At

I encounter some difficultiy when I try to draw venn graph using the package matplotlib_venn.

Details:

  • If I use the data [13, 12, 73, 3, 3, 1, 12], the graph can be produced as expected
  • If I use the data [13487, 12029, 7314, 336, 371, 17, 12611], the graph can not be generated.

What should I do?

Thanks in advance!

Code:

import matplotlib.pyplot as plt
from matplotlib_venn import venn3, venn3_circles

weights = [13, 12, 73, 3, 3, 1, 12] # these weights work
# weights = [13487, 12029,  7314,   336,   371,    17, 12611] # these weights do not work
labels  = ['100', '010', '110', '001', '101', '011', '111']

fig, axis = plt.subplots(1, 1)
v = venn3(subsets=weights, ax=axis)
for label, weight in zip(labels, weights):
    v.get_label_by_id(label).set_text(str(weight))
fig.show()
1

There are 1 best solutions below

0
On

Maybe this venn graph doesn't exists, because the weight corresponding to label '111' is larger than the weight corresponding to label '110'. Change 12611 to a smaller one will work.