A generic and colored Upset Plot generator using Plotly
Project description
Upset Plot Package
A generic Python package for generating Upset Plots using Plotly. This package allows you to visualize intersections of sets and categories, supporting both standard and colored variations.
Installation
You can install this package locally:
pip install upset_plot_plotly
Usage
Usage
import pandas as pd
from upset_plot import plot
# 1. Prepare Data
df = pd.DataFrame({
'Category A': [True, True, False, True],
'Category B': [True, False, True, True],
'Category C': [False, True, True, False]
})
categories_dict = {
'Category A': df['Category A'],
'Category B': df['Category B'],
'Category C': df['Category C']
}
# 2. Plot
fig = plot(df, categories_dict, title="My Upset Plot")
fig.show()
Colored Usage
For scenarios where you want to color-code specific elements (e.g., based on source or type):
from upset_plot import ColoredUpsetPlotGenerator
# Define colors for each category
category_colors = {
'Category A': '#D32F2F', # Red
'Category B': '#1976D2', # Blue
'Category C': 'purple'
}
upset_gen = ColoredUpsetPlotGenerator(
df,
categories_dict,
category_colors=category_colors
)
upset_gen.compute_combinations()
fig = upset_gen.plot(title="Colored Upset Plot")
fig.show()
Features
- Simple Functional API: Generate complex Upset plots with a single function call
plot(). - Interactive Visualizations: Built on top of Plotly, allowing for zoom, hover, and detailed data inspection.
- Automatic Set Size Calculation: Automatically computes set sizes and intersection counts from your DataFrame.
- Customizable Appearance:
- Bar Colors: Customize the color of the intersection bars.
- Highlighting: Use
active_colorandinactive_colorto distinguish between included and excluded sets in the matrix. - Connection Lines: Style the lines connecting the set matrix points.
- Flexible Filtering:
- Filter combinations by a minimum number of intersecting sets (
min_sets). - Display specific ranges of combinations (
combinations_range).
- Filter combinations by a minimum number of intersecting sets (
- Colored Upset Plots: Support for advanced coloring logic (e.g., coloring matrix dots based on specific categories) using
category_colors. - Responsive Layout: Auto-calculated heights with options to override for perfect integration into dashboards.
- Framework Agnostic: Works seamlessly with any Python environment (Jupyter, Streamlit, etc.) that supports Plotly.
Dependencies
- pandas
- plotly
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file upset_plot_plotly-0.2.2-py3-none-any.whl.
File metadata
- Download URL: upset_plot_plotly-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20d40c271b4beaa495b309932f62dab4c6aeca35f644e1a68bfd4295211e1899
|
|
| MD5 |
8f1256cdbd7144752a0817d40b53f464
|
|
| BLAKE2b-256 |
cc631969298e13503c99abb67e172712c2a1b8687f900543dfff6dcc1652eb5e
|
Provenance
The following attestation bundles were made for upset_plot_plotly-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on prabinrajkp/upset_plot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
upset_plot_plotly-0.2.2-py3-none-any.whl -
Subject digest:
20d40c271b4beaa495b309932f62dab4c6aeca35f644e1a68bfd4295211e1899 - Sigstore transparency entry: 821208930
- Sigstore integration time:
-
Permalink:
prabinrajkp/upset_plot@ac4239c39278eea6f44b3b9557e603bb3b6857b5 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/prabinrajkp
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ac4239c39278eea6f44b3b9557e603bb3b6857b5 -
Trigger Event:
release
-
Statement type: