Registry / data / upsetplot

upsetplot

JSON →
library0.9.0pypypi✓ verified 85d ago

A Python library to draw Lex et al.'s UpSet plots using Pandas and Matplotlib. Current version is 0.9.0, with occasional releases.

pip install upsetplot
INSTALL
IMPORT
SIG · UPSETPLOT
U
upsetplot
datapythonv0.9.0
Install
13.2s avg
Import
3313ms
Disk
255MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 3.380s · 252.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 13.2s · import 3.246s · 241MB
255MB installed
● package 255MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from upsetplot import UpSet
from upsetplot import UpSet
import upsetplot as up
Common mistake: importing the module without the UpSet class. Correct pattern is `from upsetplot import UpSet`.
from upsetplot import from_memberships
from upsetplot import from_memberships
from upsetplot import from_indicators
`from_indicators` was removed in version 0.8.0; use `from_memberships` instead.

Create a basic UpSet plot from membership lists. Uses `from_memberships` to convert data, then `UpSet().plot()`.

import pandas as pd from upsetplot import UpSet data = { 'ID': [1,2,3,4,5], 'Set1': [True, True, False, False, True], 'Set2': [False, True, True, False, False], 'Set3': [True, False, True, True, False] } df = pd.DataFrame(data) # Convert to indicator format (each row one set?): Actually upsetplot expects memberships memberships = [ ['Set1', 'Set3'], ['Set1', 'Set2'], ['Set2', 'Set3'], ['Set3'], ['Set1'] ] from upsetplot import from_memberships upset_data = from_memberships(memberships, data=df['ID']) plot = UpSet(upset_data, subset_size='count') plot.plot() import matplotlib.pyplot as plt plt.show()
Debug
Known issues
breaking`from_indicators` was removed in version 0.8.0. Use `from_memberships` or `from_abundance` instead.
fix
Replace `from_indicators(membership_matrix)` with `from_memberships(membership_lists)`.
affects: >=0.8.0
deprecatedThe `UpSet` class parameter `sort_by` with value 'degree' is deprecated; use 'cardinality'.
fix
Change `sort_by='degree'` to `sort_by='cardinality'`.
affects: >=0.6.0
gotchaWhen using `UpSet.plot()`, call `plt.show()` explicitly; otherwise the plot may not display in scripts.
fix
Add `import matplotlib.pyplot as plt; plt.show()` after `plot.plot()`.
affects: all
gotchaThe `data` parameter in `from_memberships` must be a pandas Series or array of the same length as the membership list.
fix
Ensure `data` length matches the number of elements (rows) in the membership lists.
affects: all
Errors
Common errors & fixes
AttributeError: module 'upsetplot' has no attribute 'from_indicators'
`from_indicators` was removed in version 0.8.0.
fix
Use `from upsetplot import from_memberships` and convert your indicator matrix to membership lists.
ValueError: 'degree' is not a valid value for sort_by
The `sort_by` parameter no longer accepts 'degree' since version 0.6.0; use 'cardinality'.
fix
Change `sort_by='degree'` to `sort_by='cardinality'`.
ImportError: cannot import name 'UpSet' from 'upsetplot'
Older versions of upsetplot (<0.6.0) had the UpSet class in a submodule or different name. Or you have a different library installed.
fix
Ensure you have upsetplot>=0.6.0 installed: `pip install -U upsetplot`. Use `from upsetplot import UpSet`.
Upgrade
Version history
0.9.0latest on PyPI · released Dec 31, 2023
Audit
Dependencies
pandasrequiredData input for sets
matplotlibrequiredPlotting backend
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
upsetplot — pip install upsetplot · libregistry