The cost-based layout does not let you change the relative sizes of the circles, which makes it hard for the layout to fit the circle C inside of circle B. What you need to do to help the algorithm is to artifically increase the size of the B circle with respect to C. For example, by simply adding some elements to the B/C set:
from matplotlib_venn import venn3, venn3_circles
group1 = set([1, 2, 3])
group2 = set([1, 4, 5] + [10, 11])
group3 = set([4, 5])
v = venn3([group1, group2, group3])
v.get_label_by_id("010").set_visible(False)
This results in circles A and B being of very different sizes which is, IMO, a rather misleading representation of the data:
A perhaps slightly better way of squeezing the circle C completely inside B is by:
Something like that:
from matplotlib_venn import venn3, venn3_circles
from matplotlib_venn.layout.venn3 import DefaultLayoutAlgorithm
group1 = set([1, 2, 3])
group2 = set([1, 4, 5])
group3 = set([4, 5])
sizes=[len(group1 - group2 - group3),
len(group2 - group1 - group3),
len((group1 & group2) - group3),
len(group3 - group1 - group2),
len(group3 & group1 - group2),
len(group3 & group2 - group1),
len(group1 & group2 & group3)]
# Reduce the A&B intersection size
sizes[0b011-1] *= 0.3
# Move some of the mass from B&C into B/C
sizes[0b110-1] -= 0.6
sizes[0b010-1] += 0.6
venn3(subsets = [group1, group2, group3],
layout_algorithm=DefaultLayoutAlgorithm(fixed_subset_sizes=sizes))
The two sacrifices made here are:
Whether it is acceptable or not is up to you to decide, and I suspect the original data is different. In any case, this exercise should illustrate the inherent limitations of Venn circles.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4