Note
Go to the end to download the full example code or to run this example in your browser via Binder.
UpSet view of frequent theme combinations#
UpSet plots (Lex et al. 2014) list set intersections as columns of a dot matrix with bar charts. Applied to a hypergraph of frequent itemsets, every column is a combination of themes and its bar is the support.

itemset size count support
0 (TEMPERATURE, EMISSIONS) 2 81.0 0.180000
1 (CLIMATE, EMISSIONS) 2 77.0 0.171111
2 (CLIMATE, TEMPERATURE) 2 74.0 0.164444
3 (TEMPERATURE, IPCC) 2 74.0 0.164444
4 (COAL, OIL_GAS) 2 73.0 0.162222
5 (EMISSIONS, IPCC) 2 73.0 0.162222
6 (FLOOD, DROUGHT) 2 70.0 0.155556
7 (CLIMATE, IPCC) 2 67.0 0.148889
import hatvis as hv
from hatvis.plotting import plot_upset
T = hv.datasets.make_news_transactions(n_per_period=150, random_state=0)
# [snippet:upset]
fi = hv.frequent_itemsets(T, min_support=0.06, min_size=2)
IH = hv.itemset_hypergraph(fi.head(18))
fig, axes = plot_upset(IH, title="the 18 most frequent theme combinations")
# [/snippet:upset]
print(fi.head(8).to_string())
Total running time of the script: (0 minutes 0.281 seconds)