upsetty


Nameupsetty JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/eskin22/upsetty
SummaryAn UpSet plot creation package using Plotly
upload_time2024-03-06 22:57:40
maintainer
docs_urlNone
authoreskin22
requires_python
licenseMIT
keywords upset upset-plot upsetplot set-interaction set-intersection set-interactions sets plotting visualization data-visualization visualization-tools data-visualization-tools python python3 python310 pandas plotly
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
    <img width="600px" src="upsetty/public/images/readme/assets/logo.png" alt="upsetty logo">

</div>

<p align="center">
    <img src="https://img.shields.io/badge/Latest_release-v0.1.3-blue?logo=GitHub&logoColor=white&labelColor=black&color=%23e12a61">
    <img src="https://img.shields.io/badge/Downloads-411-blue?logo=GitHub&logoColor=white&labelColor=black&color=%235596d0">
</p>

<div align="center">
<img src="https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54" alt="Python">
<img src="https://img.shields.io/badge/PLOTLY-%233F4F75?style=for-the-badge&logo=plotly&logoColor=white&labelColor=%233F4F75&color=%233F4F75" alt="Plotly">
<img src="https://img.shields.io/badge/pandas-%23150458.svg?style=for-the-badge&logo=pandas&logoColor=white" alt="Pandas">
</div>

# 📖 Table of Contents

<ul>
    <a href="#🧮-what-is-upsetty" style="text-decoration:none">
        <li>🧮 What is upsetty?</li>
    </a>
        <ul>
            <a href="#🤔-whats-an-upset-plot" style="text-decoration:none">
                <li>🤔 What's an UpSet plot?</li>
            </a>
            <a href="#✨-why-create-upsetty" style="text-decoration:none">
                <li>✨ Why create upsetty?</li>
            </a>
        </ul>
    <a href="#🚀-quickstart" style="text-decoration:none">
        <li>🚀 Quickstart</li>
    </a>
        <ul>
            <a href="#⬇️-installation" style="text-decoration:none">
                <li>⬇️ Installation</li>
            </a>
            <a href="#⚙️-usage" style="text-decoration:none">
                <li>⚙️ Usage</li>
            </a>
        </ul>
    <a href="#📌-future-plans" style="text-decoration:none">
        <li>📌 Future Plans</li>
    </a>
</ul>

# 🧮 What is upsetty? <img src="upsetty/public/images/readme/assets/B_watermark.svg" height="30" align="center" alt="Watermark">

Python package for creating [UpSet plots](https://en.wikipedia.org/wiki/UpSet_Plot) using [Plotly](https://github.com/plotly/plotly.py).

### 🤔 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](https://en.wikipedia.org/wiki/Venn_diagram) or [Euler diagrams](https://en.wikipedia.org/wiki/Euler_diagram), which can become cluttered and hard to read with more than a few sets.

<div align="center">
    <img width="600px" src="https://github.com/eskin22/upsetty/blob/main/upsetty/public/images/readme/examples/comparing_venn_and_upset.png?raw=true" alt="Comparing Venn Diagram and UpSet Plot for 5 Interacting Sets">
</div>

### ✨ 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 are too verbose. 

To that end, **we offer upsetty as a lightweight, easy-to-use alternative for analyzing overlapping sets in Python.**

> #### 🤩 Like this repository? Giving a ⭐️ really helps out!

# 🚀 Quickstart

### ⬇️ Installation

```
pip install upsetty
```

### ⚙️ Usage

```
from upsetty import Upset
```

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

```
import pandas as pd

# create sample data ({'class_name': [boolean indicators]})
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]
}

# convert sample data dict to pd.DataFrame
df = pd.DataFrame(data)
```

Then, simply pass the DataFrame to the `generate_plot` method to create a Plotly figure of an UpSet plot.

```
# create UpSet figure
upset = Upset.generate_plot(df)

# show the figure
upset.show()
```

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

<p align="center">
    <img src='https://github.com/eskin22/upsetty/blob/main/upsetty/public/images/readme/examples/upset_chart_demo_0.png?raw=true' alt="Example UpSet Plot">
</p>

> [!NOTE]  
> If you're having trouble getting the output pictured above, you can run the demo script located at [upsetty/demo.py](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(
    
    # sample data
    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'
)
```
<p align="center">
    <img src="https://github.com/eskin22/upsetty/blob/main/upsetty/public/images/readme/examples/upset_chart_demo_1.png?raw=true" alt="Example UpSet Plot with Custom Format">
</p>

By default, the function expects a `DataFrame` with columns of all boolean values, indicating the presence of absence of a given class.

If you wish to compute set instersection based on some other value in your data, you can do so like this:

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

    # adding a column 'Value' of non-boolean numbers
    'Value': [1, 2, 3, 4, 5, 6, 7]
}

df = pd.DataFrame(data)

upset = Upset.generate_plot(df, 'Value')
upset.show()
```

The code above will compute the sum of values for each subset within the classes, as depicted below.

<p align="center">
    <img src="https://github.com/eskin22/upsetty/blob/main/upsetty/public/images/readme/examples/upset_chart_demo_2.png?raw=true" alt="Example UpSet Plot based on 'Value'">
</p>

# 📌 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.




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eskin22/upsetty",
    "name": "upsetty",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "upset,upset-plot,upsetplot,set-interaction,set-intersection,set-interactions,sets,plotting,visualization,data-visualization,visualization-tools,data-visualization-tools,python,python3,python310,pandas,plotly",
    "author": "eskin22",
    "author_email": "blakepmcbride@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e0/42/5a4c489c4b7616a13a06e7da710afc0a949f8adc1cf3bc17c34fe68e35a4/upsetty-0.1.3.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n    <img width=\"600px\" src=\"upsetty/public/images/readme/assets/logo.png\" alt=\"upsetty logo\">\n\n</div>\n\n<p align=\"center\">\n    <img src=\"https://img.shields.io/badge/Latest_release-v0.1.3-blue?logo=GitHub&logoColor=white&labelColor=black&color=%23e12a61\">\n    <img src=\"https://img.shields.io/badge/Downloads-411-blue?logo=GitHub&logoColor=white&labelColor=black&color=%235596d0\">\n</p>\n\n<div align=\"center\">\n<img src=\"https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54\" alt=\"Python\">\n<img src=\"https://img.shields.io/badge/PLOTLY-%233F4F75?style=for-the-badge&logo=plotly&logoColor=white&labelColor=%233F4F75&color=%233F4F75\" alt=\"Plotly\">\n<img src=\"https://img.shields.io/badge/pandas-%23150458.svg?style=for-the-badge&logo=pandas&logoColor=white\" alt=\"Pandas\">\n</div>\n\n# \ud83d\udcd6 Table of Contents\n\n<ul>\n    <a href=\"#\ud83e\uddee-what-is-upsetty\" style=\"text-decoration:none\">\n        <li>\ud83e\uddee What is upsetty?</li>\n    </a>\n        <ul>\n            <a href=\"#\ud83e\udd14-whats-an-upset-plot\" style=\"text-decoration:none\">\n                <li>\ud83e\udd14 What's an UpSet plot?</li>\n            </a>\n            <a href=\"#\u2728-why-create-upsetty\" style=\"text-decoration:none\">\n                <li>\u2728 Why create upsetty?</li>\n            </a>\n        </ul>\n    <a href=\"#\ud83d\ude80-quickstart\" style=\"text-decoration:none\">\n        <li>\ud83d\ude80 Quickstart</li>\n    </a>\n        <ul>\n            <a href=\"#\u2b07\ufe0f-installation\" style=\"text-decoration:none\">\n                <li>\u2b07\ufe0f Installation</li>\n            </a>\n            <a href=\"#\u2699\ufe0f-usage\" style=\"text-decoration:none\">\n                <li>\u2699\ufe0f Usage</li>\n            </a>\n        </ul>\n    <a href=\"#\ud83d\udccc-future-plans\" style=\"text-decoration:none\">\n        <li>\ud83d\udccc Future Plans</li>\n    </a>\n</ul>\n\n# \ud83e\uddee What is upsetty? <img src=\"upsetty/public/images/readme/assets/B_watermark.svg\" height=\"30\" align=\"center\" alt=\"Watermark\">\n\nPython package for creating [UpSet plots](https://en.wikipedia.org/wiki/UpSet_Plot) using [Plotly](https://github.com/plotly/plotly.py).\n\n### \ud83e\udd14 What's an UpSet Plot?\n\nAn 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](https://en.wikipedia.org/wiki/Venn_diagram) or [Euler diagrams](https://en.wikipedia.org/wiki/Euler_diagram), which can become cluttered and hard to read with more than a few sets.\n\n<div align=\"center\">\n    <img width=\"600px\" src=\"https://github.com/eskin22/upsetty/blob/main/upsetty/public/images/readme/examples/comparing_venn_and_upset.png?raw=true\" alt=\"Comparing Venn Diagram and UpSet Plot for 5 Interacting Sets\">\n</div>\n\n### \u2728 Why create upsetty?\n\nCurrently, 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 are too verbose. \n\nTo that end, **we offer upsetty as a lightweight, easy-to-use alternative for analyzing overlapping sets in Python.**\n\n> #### \ud83e\udd29 Like this repository? Giving a \u2b50\ufe0f really helps out!\n\n# \ud83d\ude80 Quickstart\n\n### \u2b07\ufe0f Installation\n\n```\npip install upsetty\n```\n\n### \u2699\ufe0f Usage\n\n```\nfrom upsetty import Upset\n```\n\nTo create an UpSet plot, we structure the data like this: \n\n```\nimport pandas as pd\n\n# create sample data ({'class_name': [boolean indicators]})\ndata = {\n    'Class A': [True, True, True, False, False, True],\n    'Class B': [True, True, True, True, True, False],\n    'Class C': [False, False, False, True, True, True]\n}\n\n# convert sample data dict to pd.DataFrame\ndf = pd.DataFrame(data)\n```\n\nThen, simply pass the DataFrame to the `generate_plot` method to create a Plotly figure of an UpSet plot.\n\n```\n# create UpSet figure\nupset = Upset.generate_plot(df)\n\n# show the figure\nupset.show()\n```\n\nUsing the sample data provided above, the output is pictured below:\n\n<p align=\"center\">\n    <img src='https://github.com/eskin22/upsetty/blob/main/upsetty/public/images/readme/examples/upset_chart_demo_0.png?raw=true' alt=\"Example UpSet Plot\">\n</p>\n\n> [!NOTE]  \n> If you're having trouble getting the output pictured above, you can run the demo script located at [upsetty/demo.py](upsetty/demo.py).\n\nYou can also change the colors and sizing for various aspects of the plot by passing additional parameters to the `generate_plot` function like so:\n\n```\nupset = Upset.generate_plot(\n    \n    # sample data\n    df,\n\n    # change category colors to a light blue, green, and yellow\n    categories_colors=['#3987CA', '#FFC300', '#39CA41'],\n\n    # change the category label color to a dark black\n    categorylabel_color='#2F2F2F',\n\n    # change the bar intersect color to a soft black\n    bar_intersect_color='#454545',\n\n    # change the marker line color to a soft black\n    markerline_color='#454545'\n)\n```\n<p align=\"center\">\n    <img src=\"https://github.com/eskin22/upsetty/blob/main/upsetty/public/images/readme/examples/upset_chart_demo_1.png?raw=true\" alt=\"Example UpSet Plot with Custom Format\">\n</p>\n\nBy default, the function expects a `DataFrame` with columns of all boolean values, indicating the presence of absence of a given class.\n\nIf you wish to compute set instersection based on some other value in your data, you can do so like this:\n\n```\ndata = {\n    'Class A': [True, True, False, False, True, True, False],\n    'Class B': [True, False, True, False, True, False, True],\n    'Class C': [True, False, False, True, False, True, True],\n\n    # adding a column 'Value' of non-boolean numbers\n    'Value': [1, 2, 3, 4, 5, 6, 7]\n}\n\ndf = pd.DataFrame(data)\n\nupset = Upset.generate_plot(df, 'Value')\nupset.show()\n```\n\nThe code above will compute the sum of values for each subset within the classes, as depicted below.\n\n<p align=\"center\">\n    <img src=\"https://github.com/eskin22/upsetty/blob/main/upsetty/public/images/readme/examples/upset_chart_demo_2.png?raw=true\" alt=\"Example UpSet Plot based on 'Value'\">\n</p>\n\n# \ud83d\udccc Future Plans\n\n### Auto-adjusting margins for variable class labels\n\nCurrently, 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. \n\n### Intersection highlighting\n\nThe 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.\n\n### Intersection count makeup\n\nThe ability to show the makeups of the different classes in a set intersection count.\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An UpSet plot creation package using Plotly",
    "version": "0.1.3",
    "project_urls": {
        "Download": "https://pypi.org/project/upsetty/",
        "Homepage": "https://github.com/eskin22/upsetty"
    },
    "split_keywords": [
        "upset",
        "upset-plot",
        "upsetplot",
        "set-interaction",
        "set-intersection",
        "set-interactions",
        "sets",
        "plotting",
        "visualization",
        "data-visualization",
        "visualization-tools",
        "data-visualization-tools",
        "python",
        "python3",
        "python310",
        "pandas",
        "plotly"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3dad967931821f82a95349929ac41da8924cd06d7b5403d76898e6897b20a79d",
                "md5": "628715b8e8d4ddbd1fd022bc275fdbbf",
                "sha256": "33455ef81ced11d10f3a0542d11a027bed90206498c6dbba3df968db93c196a7"
            },
            "downloads": -1,
            "filename": "upsetty-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "628715b8e8d4ddbd1fd022bc275fdbbf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8334,
            "upload_time": "2024-03-06T22:57:38",
            "upload_time_iso_8601": "2024-03-06T22:57:38.482870Z",
            "url": "https://files.pythonhosted.org/packages/3d/ad/967931821f82a95349929ac41da8924cd06d7b5403d76898e6897b20a79d/upsetty-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e0425a4c489c4b7616a13a06e7da710afc0a949f8adc1cf3bc17c34fe68e35a4",
                "md5": "84e37e5db8424e325b640c6d44aa1598",
                "sha256": "e22ac087afbbb988b64f381ba55b120351feb9742582aa9c0485622381126e73"
            },
            "downloads": -1,
            "filename": "upsetty-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "84e37e5db8424e325b640c6d44aa1598",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9714,
            "upload_time": "2024-03-06T22:57:40",
            "upload_time_iso_8601": "2024-03-06T22:57:40.185429Z",
            "url": "https://files.pythonhosted.org/packages/e0/42/5a4c489c4b7616a13a06e7da710afc0a949f8adc1cf3bc17c34fe68e35a4/upsetty-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-06 22:57:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eskin22",
    "github_project": "upsetty",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "upsetty"
}
        
Elapsed time: 0.25651s