Skip to main content

An upset plot creation package using Plotly

Project description

Created by Blake McBride



Python Plotly Pandas

🧐 What is this project?

Python package for creating UpSet plots using Plotly.

What's an UpSet Plot?

An UpSet plot is a diagram used to quantitatively visualize sets and their interactions. They are particularly useful visuals for determining the overlap between different groups, as an alternative to Venn or Euler diagrams, which can become cluttered and hard to read with more than a few sets.

Why create upsetty?

Currently, the number of tools to create UpSet plots is very limited. Indeed, many of the previous packages for creating these plots have been deprecated or verbose. To that end, we offer upsetty as a lightweight, easy-to-use alternative for analyzing overlapping sets in Python.

🚀 Installation

[!NOTE]
This package is currently unavailable on PyPi. We're working on getting the project set up there so that you can use pip for installation in the future. For now, the only way to use this is via cloning the repo to your local.

Clone this Repository

The instructions below are adapted from GitHub's documentation on cloning repositories; for more information, please refer to the docs.

Show instructions
  1. Navigate to the main page of the repository.

  2. Above the list of files, click <> Code.

  3. Copy the URL for the repository.

    • To clone the repository using HTTPS, under "HTTPS", click .
  4. Open Git Bash.

  5. Change the current working directory to the location where you want the cloned repository. e.g.

    cd path/to/folder
    
  6. Type git clone, and then paste the URL you copied earlier, e.g.

    git clone https://github.com/eskin22/upsetty
    
  7. Press Enter to create your local clone.

🛠 Usage

Once you've installed the package, you can simply import the Upset class like so:

from upset import Upset

Then, to create an UpSet plot, we structure the data like this:

import pandas as pd

data = {
    'Class A': [True, True, True, False, False, True],
    'Class B': [True, True, True, True, True, False],
    'Class C': [False, False, False, True, True, True]
}

df = pd.DataFrame(data)

After creating your sample data, you can simply pass the DataFrame to the generate_plot method to create a plotly figure of an UpSet plot.

upset = Upset.generate_plot(df)
upset.show()

Using the sample data provided above, the output is pictured below:

[!NOTE]
If you're having trouble getting the output pictured above, you can run the demo script located at upsetty/demo.py.

You can also change the colors and sizing for various aspects of the plot by passing additional parameters to the generate_plot function like so:

upset = Upset.generate_plot(
    df,
    # change category colors to a light blue, green, and yellow
    categories_colors=['#3987CA', '#FFC300', '#39CA41'],

    # change the category label color to a dark black
    categorylabel_color='#2F2F2F',

    # change the bar intersect color to a soft black
    bar_intersect_color='#454545',

    # change the marker line color to a soft black
    markerline_color='#454545'
)

📌 Future Plans

Auto-adjusting margins for variable class labels

Currently, the upsetty works best with 3-4 class labels. More or less than that causes the class labels to be misaligned. Future improvements will add capabilities for auto-adjusting the margins based on the number of class labels contained in the visual.

Intersection highlighting

The ability to highlight specific intersections would give the user a way to focus their visual on specific set interactions as opposed to the basic highlighting.

Intersection count makeup

The ability to show the makeups of the different classes in a set intersection count.

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

upsetty-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

upsetty-0.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file upsetty-0.1.0.tar.gz.

File metadata

  • Download URL: upsetty-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for upsetty-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd75672c04f90b699249c15fad40fce250dde652ace264be4961ca6eb0c488c3
MD5 7a19d5ae1e765857c60c526e4637d470
BLAKE2b-256 ac516ed0c243c3bc72b3120c2bc488cff9ab0dcc77d8e853c52612ef36c7b8fd

See more details on using hashes here.

File details

Details for the file upsetty-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: upsetty-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for upsetty-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9c5d6579cbc95db7bab1429eb3635e1a49b886c1d989b031718628b29ade924
MD5 e0388163079ddb07102353ab6ff24745
BLAKE2b-256 2b2a9bde32c789ba3848372dac992c786a4a5f8da65f840649a420c54ecf6993

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