Linked Questions

Popular Questions

I tried to create an upset plot and display intersection among different sets.
But my upset plot is displaying dinstinct value counts among sets.
How do I change it to intersections instead of distinct counts?

This is my code:

mammals = ['Cat', 'Dog', 'Horse', 'Sheep', 'Pig', 'Cattle', 'Rhinoceros', 'Moose']
herbivores = ['Horse', 'Sheep', 'Cattle', 'Moose', 'Rhinoceros']
domesticated = ['Dog', 'Chicken', 'Horse', 'Sheep', 'Pig', 'Cattle', 'Duck']
from upsetplot import from_contents
animals = from_contents({'mammal': mammals, 'herbivore': herbivores, 'domesticated': domesticated})
from upsetplot import UpSet
ax_dict = UpSet(animals, subset_size='count',show_counts=True).plot()

This is my output:

Output

The actual intersection between herbivores and mammals is 5 while my plot shows 2.
Can anyone help me how to show intersections in upset plots?

Related Questions