By default matplotlib-venn's venn3 prints counts in each overlap. How do I print percentages instead?
How do I print percentages in matplotlib-venn diagrams?
707 Views Asked by Harm At
2
There are 2 best solutions below
0
On
A cleaner way is to use the subset_label_formatter argument, as described in this answer: https://stackoverflow.com/a/53490475/4133418
It would look something like this:
venn = venn3(subsets=subsets, set_labels=('Set1', 'Set2', 'Set3'),
subset_label_formatter=lambda x: f"{(x/total):1.0%})
I figured it out. Just divide each label by the total: