altair-upset

Create interactive UpSet plots using Altair

https://github.com/edmundmiller/altair-upset

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary

Keywords

altair plot sets upset upsetplot vega vega-lite visualization
Last synced: 4 months ago · JSON representation ·

Repository

Create interactive UpSet plots using Altair

Basic Info
Statistics
  • Stars: 6
  • Watchers: 1
  • Forks: 2
  • Open Issues: 11
  • Releases: 5
Topics
altair plot sets upset upsetplot vega vega-lite visualization
Created 11 months ago · Last pushed 4 months ago
Metadata Files
Readme Changelog License Citation

README.md

Altair UpSet

PyPI version Python Version Documentation Status License: MIT

Create beautiful and interactive UpSet plots using Altair. UpSet plots are a powerful alternative to Venn diagrams for visualizing set intersections, especially when dealing with many sets.

Example UpSet Plot

Features

  • 🎨 Beautiful, interactive visualizations powered by Altair/Vega-Lite
  • 🔄 Dynamic sorting by frequency or degree
  • 🎯 Interactive highlighting and filtering
  • 📱 Responsive design that works in Jupyter notebooks and web browsers
  • 🎨 Customizable colors, sizes, and themes
  • 🔍 Tooltips with detailed intersection information
  • 🚀 Support for both Pandas and Polars DataFrames

Installation

bash pip install altair-upset

Or with conda:

bash conda install -c conda-forge altair-upset

Quick Start

```python import altair_upset as au import pandas as pd

Or use Polars

import polars as pl

Create sample data with Pandas

data = pd.DataFrame({ 'set1': [1, 0, 1, 1], 'set2': [1, 1, 0, 1], 'set3': [0, 1, 1, 0] })

Create UpSet plot

chart = au.UpSetAltair( data=data, # or datapl.topandas() sets=["set1", "set2", "set3"], title="Sample UpSet Plot" )

Display the chart

chart.show() ```

Example Gallery

The package includes a comprehensive gallery of examples demonstrating various features and use cases:

Basic Examples

  • Basic UpSet Plot: Simple visualization of streaming service subscriptions
  • Sorting and Filtering: Different ways to organize and present set intersections
  • Custom Styling: Examples of color schemes, themes, and layout customization

Real-World Examples

  • Gene Set Analysis: Visualizing intersections of biological pathways
  • Survey Response Analysis: Understanding multiple-choice survey patterns
  • Social Media Usage: Exploring platform usage overlaps with demographics
  • Movie Genre Analysis: Investigating genre combinations in film datasets

Advanced Features

  • Interactive Selection: Enhanced interaction and filtering capabilities
  • Custom Tooltips: Rich tooltips with additional information
  • Responsive Design: Adapting to different display sizes
  • Theme Examples: Using built-in and custom themes

To run the examples:

bash git clone https://github.com/edmundmiller/altair-upset.git cd altair-upset pip install -e ".[examples]" python examples/basic_upset.py

Each example includes:

  • Sample data generation or loading
  • Plot creation with different features
  • Analysis and statistics
  • Detailed comments explaining each step

Advanced Usage

Sorting and Filtering

```python

Sort by degree (number of sets in intersection)

chart = au.UpSetAltair( data=data, sets=["set1", "set2", "set3"], sortby="degree", sortorder="descending" ) ```

Customizing Appearance

```python

Custom colors and sizes

chart = au.UpSetAltair( data=data, sets=["set1", "set2", "set3"], colorrange=["#1f77b4", "#ff7f0e", "#2ca02c"], highlightcolor="#d62728", width=800, height=500 ) ```

Using Abbreviations

```python

Use abbreviations for long set names

chart = au.UpSetAltair( data=data, sets=["Very Long Set Name 1", "Very Long Set Name 2", "Very Long Set Name 3"], abbre=["S1", "S2", "S3"] ) ```

Development

  1. Clone the repository:

bash git clone https://github.com/edmundmiller/altair-upset.git cd altair-upset

  1. Create a virtual environment and install dependencies:

bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -e ".[dev,test,docs]"

  1. Install pre-commit hooks:

bash pre-commit install

  1. Run tests:

bash pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Credits

This package is based on the UpSet: Visualization of Intersecting Sets technique. If you use an UpSet figure in a publication, please cite the original paper:

Alexander Lex, Nils Gehlenborg, Hendrik Strobelt, Romain Vuillemot, Hanspeter Pfister, UpSet: Visualization of Intersecting Sets, IEEE Transactions on Visualization and Computer Graphics (InfoVis '14), vol. 20, no. 12, pp. 1983–1992, 2014. doi: 10.1109/TVCG.2014.2346248

The original function was from hms-dbmi/upset-altair-notebook. The following updates from that are:

  1. Turning it into a package
  2. Snapshoting the functionality with Altair 4
  3. Porting to Altair 5
  4. Adding additional advanced features

Owner

  • Name: Edmund Miller
  • Login: edmundmiller
  • Kind: user
  • Location: Texas
  • Company: @seqeralabs

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite both the software and the original UpSet paper as below."
authors:
- family-names: "Miller"
  given-names: "Edmund"
title: "Upset Altair"
version: 0.3.0
type: software
url: "https://github.com/edmundmiller/altair-upset"
preferred-citation:
  type: article
  authors:
  - family-names: "Lex"
    given-names: "Alexander"
  - family-names: "Gehlenborg"
    given-names: "Nils"
  - family-names: "Strobelt"
    given-names: "Hendrik"
  - family-names: "Vuillemot"
    given-names: "Romain"
  - family-names: "Pfister"
    given-names: "Hanspeter"
  title: "UpSet: Visualization of Intersecting Sets"
  journal: "IEEE Transactions on Visualization and Computer Graphics"
  volume: 20
  issue: 12
  year: 2014
  start: 1983
  end: 1992
  doi: "10.1109/TVCG.2014.2346248"

GitHub Events

Total
  • Issues event: 6
  • Watch event: 4
  • Delete event: 7
  • Issue comment event: 7
  • Push event: 28
  • Pull request review event: 1
  • Pull request event: 20
  • Fork event: 2
  • Create event: 10
Last Year
  • Issues event: 6
  • Watch event: 4
  • Delete event: 7
  • Issue comment event: 7
  • Push event: 28
  • Pull request review event: 1
  • Pull request event: 20
  • Fork event: 2
  • Create event: 10

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 88
  • Total Committers: 3
  • Avg Commits per committer: 29.333
  • Development Distribution Score (DDS): 0.045
Past Year
  • Commits: 88
  • Committers: 3
  • Avg Commits per committer: 29.333
  • Development Distribution Score (DDS): 0.045
Top Committers
Name Email Commits
Edmund Miller g****t@e****v 84
renovate[bot] 2****] 3
Minniti Julien m****6@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 6
  • Total pull requests: 23
  • Average time to close issues: N/A
  • Average time to close pull requests: 28 days
  • Total issue authors: 2
  • Total pull request authors: 4
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.3
  • Merged pull requests: 7
  • Bot issues: 1
  • Bot pull requests: 16
Past Year
  • Issues: 6
  • Pull requests: 23
  • Average time to close issues: N/A
  • Average time to close pull requests: 28 days
  • Issue authors: 2
  • Pull request authors: 4
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.3
  • Merged pull requests: 7
  • Bot issues: 1
  • Bot pull requests: 16
Top Authors
Issue Authors
  • edmundmiller (5)
  • renovate[bot] (1)
Pull Request Authors
  • renovate[bot] (16)
  • Jumitti (3)
  • caleb-lindgren (2)
  • edmundmiller (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 67 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 1
pypi.org: altair-upset

Create interactive UpSet plots using Altair

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 67 Last month
Rankings
Dependent packages count: 9.7%
Average: 32.3%
Dependent repos count: 54.9%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • codecov/codecov-action v4 composite
  • peaceiris/actions-gh-pages v3 composite
pyproject.toml pypi
  • altair >=5.0.0,<6.0.0
  • pandas >=2.0.0,<3.0.0
.github/workflows/publish.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v4 composite
  • pypa/gh-action-pypi-publish release/v1 composite
  • sigstore/gh-action-sigstore-python v3.0.0 composite
uv.lock pypi
  • accessible-pygments 0.0.5
  • alabaster 0.7.16
  • altair 5.5.0
  • altair-upset 0.3.1.dev28+gdf0cbf4.d20250120
  • attrs 24.3.0
  • babel 2.16.0
  • beautifulsoup4 4.12.3
  • black 24.10.0
  • certifi 2024.12.14
  • cfgv 3.4.0
  • charset-normalizer 3.4.1
  • click 8.1.8
  • colorama 0.4.6
  • contourpy 1.3.0
  • contourpy 1.3.1
  • coverage 7.6.10
  • cycler 0.12.1
  • distlib 0.3.9
  • docstrfmt 1.9.0
  • docutils 0.20.1
  • exceptiongroup 1.2.2
  • filelock 3.16.1
  • fonttools 4.55.3
  • identify 2.6.5
  • idna 3.10
  • imagesize 1.4.1
  • importlib-metadata 8.5.0
  • importlib-resources 6.5.2
  • iniconfig 2.0.0
  • jinja2 3.1.5
  • jsonschema 4.23.0
  • jsonschema-specifications 2024.10.1
  • kiwisolver 1.4.7
  • kiwisolver 1.4.8
  • libcst 1.6.0
  • markdown-it-py 3.0.0
  • markupsafe 3.0.2
  • matplotlib 3.9.4
  • matplotlib 3.10.0
  • mdit-py-plugins 0.4.2
  • mdurl 0.1.2
  • mslex 1.3.0
  • mypy-extensions 1.0.0
  • myst-parser 3.0.1
  • narwhals 1.22.0
  • nodeenv 1.9.1
  • numpy 2.0.2
  • numpydoc 1.8.0
  • packaging 24.2
  • pandas 2.2.3
  • pathspec 0.12.1
  • pillow 11.1.0
  • platformdirs 4.3.6
  • pluggy 1.5.0
  • polars 1.20.0
  • pre-commit 4.0.1
  • psutil 6.1.1
  • pyarrow 19.0.0
  • pydata-sphinx-theme 0.16.1
  • pygments 2.19.1
  • pyparsing 3.2.1
  • pytest 8.3.4
  • pytest-cov 6.0.0
  • python-dateutil 2.9.0.post0
  • pytz 2024.2
  • pyyaml 6.0.2
  • referencing 0.36.1
  • requests 2.32.3
  • rpds-py 0.22.3
  • ruff 0.9.2
  • six 1.17.0
  • snowballstemmer 2.2.0
  • soupsieve 2.6
  • sphinx 7.4.7
  • sphinxcontrib-applehelp 2.0.0
  • sphinxcontrib-devhelp 2.0.0
  • sphinxcontrib-htmlhelp 2.1.0
  • sphinxcontrib-jsmath 1.0.1
  • sphinxcontrib-qthelp 2.0.0
  • sphinxcontrib-serializinghtml 2.0.0
  • sphinxext-altair 0.2.0
  • syrupy 4.8.1
  • tabulate 0.9.0
  • taskipy 1.14.1
  • toml 0.10.2
  • tomli 2.2.1
  • typing-extensions 4.12.2
  • tzdata 2024.2
  • urllib3 2.3.0
  • virtualenv 20.29.1
  • vl-convert-python 1.7.0
  • zipp 3.21.0