Skip to main content

Create interactive UpSet plots using Altair

Project description

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

Installation

pip install altair-upset

Or with conda:

conda install -c conda-forge altair-upset

Quick Start

import altair_upset as au
import pandas as pd

# Create sample data
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,
    sets=["set1", "set2", "set3"],
    title="Sample UpSet Plot"
)

# Display the chart
chart.show()

Advanced Usage

Sorting and Filtering

# Sort by degree (number of sets in intersection)
chart = au.UpSetAltair(
    data=data,
    sets=["set1", "set2", "set3"],
    sort_by="degree",
    sort_order="descending"
)

Customizing Appearance

# Custom colors and sizes
chart = au.UpSetAltair(
    data=data,
    sets=["set1", "set2", "set3"],
    color_range=["#1f77b4", "#ff7f0e", "#2ca02c"],
    highlight_color="#d62728",
    width=800,
    height=500
)

Using Abbreviations

# 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:
git clone https://github.com/edmundmiller/altair-upset.git
cd altair-upset
  1. Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -e ".[dev,test,docs]"
  1. Install pre-commit hooks:
pre-commit install
  1. Run tests:
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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

altair_upset-0.3.0.tar.gz (848.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

altair_upset-0.3.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file altair_upset-0.3.0.tar.gz.

File metadata

  • Download URL: altair_upset-0.3.0.tar.gz
  • Upload date:
  • Size: 848.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.13

File hashes

Hashes for altair_upset-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1e785c14772bc38e6b5a1c8a423461999b3d62168127feff0a0e84b7702e62a3
MD5 22041cedeb9c601431a91267736d9bc4
BLAKE2b-256 bafd281d369210e4b88433009068fb59991453bc4f7b4956459397b9eb6700d6

See more details on using hashes here.

File details

Details for the file altair_upset-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for altair_upset-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 105ac71ff19434bc252fb2a0ea48f9b016266abf01f8de8cbb7fa14458cc5b93
MD5 7bc5f340906934baac300a493efaf654
BLAKE2b-256 93979818f76010403f7382988509ec24d85e5ebdc039f71b37547ff5deb2302e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page