Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you remove data labels in matplotlib_venn?

Not the text labels outside the circles, I can remove them by changing them to empty strings.

I mean the actual numbers on the circles showing the value of each patch. I can't find how to remove these. Is there a way? Or is there a way to change the colour of them, so that I can just blend them into the background?

like image 909
user43107 Avatar asked Dec 14 '25 05:12

user43107


1 Answers

Borrowing the "base-code" from this question I think I have come to a solution for you:

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'])

out = venn3([set1, set2, set3], ('Set1', 'Set2', 'Set3'))
for idx, subset in enumerate(out.subset_labels):
    out.subset_labels[idx].set_visible(False)

plt.show(out)

This walks through all of the subset_labels and sets the visibility to False. Effectively removing the text.

like image 66
Hampus Larsson Avatar answered Dec 16 '25 21:12

Hampus Larsson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!