Upset plot Example#

Here shows how to draw upset plot

import numpy as np
import pandas as pd

import milkviz as mv

Data input for upset plot#

# A list of any sequence, intersections between lists will be computed for you, duplicates will not considred
# Noted that this is the difference from input in venn diagram.
mammals = ['Cat', 'Dog', 'Horse', 'Sheep', 'Pig', 'Cattle', 'Rhinoceros', 'Moose']
herbivores = ['Horse', 'Sheep', 'Cattle', 'Moose', 'Rhinoceros']
domesticated = ['Dog', 'Chicken', 'Horse', 'Sheep', 'Pig', 'Cattle', 'Duck']

Create the upset plot#

mv.upset([mammals, herbivores, domesticated], names=['mammals', 'herbivores', 'domesticated'])
plot upset


<Figure size 488.889x400 with 4 Axes>

Total running time of the script: ( 0 minutes 0.519 seconds)

Gallery generated by Sphinx-Gallery