Skip to main content

UpSet.js is a re-implementation of UpSetR to create interactive set visualizations for more than three sets

Project description

UpSet.js Jupyter Widget

NPM Package Github Actions Open in NBViewer Open in Binder Open API Docs Open Example

A Jupyter Widget Library around UpSet.js.

This package is part of the UpSet.js ecosystem located at the main Github Monorepo.

Installation

You can install using pip:

# some ipywidget 8.x.x alpha vesion
pip install ipywidgets upsetjs_jupyter_widget
# for notebooks
jupyter nbextension enable --sys-prefix --py upsetjs_jupyter_widget
# for lab
jupyter labextension install @jupyter-widgets/jupyterlab-manager upsetjs_jupyter_widget

Usage

from ipywidgets import interact
from upsetjs_jupyter_widget import UpSetJSWidget
import pandas as pd
w = UpSetJSWidget[str]()
w.from_dict(dict(one = ['a', 'b', 'c', 'e', 'g', 'h', 'k', 'l', 'm'], two = ['a', 'b', 'd', 'e', 'j'], three = ['a', 'e', 'f', 'g', 'h', 'i', 'j', 'l', 'm']))
w

upset_from_dict

df = pd.DataFrame(dict(
    one=[1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1],
    two=[1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0],
    three=[1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1]
), index=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'])
w.from_dataframe(df)
w

upset_from_dataframe

it support the ipywidget interact method to get notified about the user input

def selection_changed(s):
    return s.name if s else None
interact(selection_changed, s=w)

see also introduction.ipynb

see also Open in NBViewer Open in Binder

Documentation

the package documentation is located at Open API Docs. An introduction Jupyter Notebooks is at Open Example.

Venn Diagram

Besides the main UpSet.js plot also Venn Diagrams for up to five sets are supported. It uses the same input formats and has similar functionality in terms of interaction.

from upsetjs_jupyter_widget import UpSetJSVennDiagramWidget
v = UpSetJSVennDiagramWidget[str]()
v.from_dict(dict(one = ['a', 'b', 'c', 'e', 'g', 'h', 'k', 'l', 'm'], two = ['a', 'b', 'd', 'e', 'j'], three = ['a', 'e', 'f', 'g', 'h', 'i', 'j', 'l', 'm']))
v

image

see also venn.ipynb

Karnaugh Map

Besides the main UpSet.js plot also a variant of a Karnaugh Map. It uses the same input formats and has similar functionality in terms of interaction.

from upsetjs_jupyter_widget import UpSetJSKarnaughMapWidget
v = UpSetJSKarnaughMapWidget[str]()
v.from_dict(dict(one = ['a', 'b', 'c', 'e', 'g', 'h', 'k', 'l', 'm'], two = ['a', 'b', 'd', 'e', 'j'], three = ['a', 'e', 'f', 'g', 'h', 'i', 'j', 'l', 'm']))
v

image

see also kmap.ipynb

Dev Environment

npm i -g yarn
yarn set version berry
yarn
yarn pnpify --sdk vscode
conda create -f environment.yml
conda activate upsetjs_jupyter_widget
pip install -e .
jupyter nbextension install --sys-prefix --overwrite --py upsetjs_jupyter_widget
jupyter nbextension enable --sys-prefix --py upsetjs_jupyter_widget
jupyter labextension install @jupyter-widgets/jupyterlab-manager .

Commands

yarn test
yarn lint
yarn build  !! within the pipenv

Privacy Policy

UpSet.js is a client only library. The library or any of its integrations doesn't track you or transfers your data to any server. The uploaded data in the app are stored in your browser only using IndexedDB. The Tableau extension can run in a sandbox environment prohibiting any server requests. However, as soon as you export your session within the app to an external service (e.g., Codepen.io) your data will be transferred.

License / Terms of Service

Commercial license

If you want to use Upset.js for a commercial application the commercial license is the appropriate license. Contact @sgratzl for details.

Open-source license

This library is released under the GNU AGPLv3 version to be used for private and academic purposes. In case of a commercial use, please get in touch regarding a commercial license.

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

upsetjs_jupyter_widget-1.9.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

upsetjs_jupyter_widget-1.9.0-py2.py3-none-any.whl (543.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file upsetjs_jupyter_widget-1.9.0.tar.gz.

File metadata

  • Download URL: upsetjs_jupyter_widget-1.9.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for upsetjs_jupyter_widget-1.9.0.tar.gz
Algorithm Hash digest
SHA256 8e2dc9cc94f33315c5d4d3ebaf42ac89637ec1400da0c3fec3d51a990d31cfb8
MD5 23e277f57087014c3173fb686a510706
BLAKE2b-256 cc3227197fa1026b5456cd8a8f800caf0a3a5e5b0ffea8e9d0b1f9c91db9c175

See more details on using hashes here.

File details

Details for the file upsetjs_jupyter_widget-1.9.0-py2.py3-none-any.whl.

File metadata

  • Download URL: upsetjs_jupyter_widget-1.9.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 543.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for upsetjs_jupyter_widget-1.9.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 307771277e7e037f7a0c910c2f90c6bb0ae97dcbd1e3ca9058950ef29597cbc5
MD5 c46ae10fd1a1966d7063c90ec8881c60
BLAKE2b-256 12825eec7270c345872d3d1dbb2ca025e7027f7369c8ef3d85bb011c583c3068

See more details on using hashes here.

Supported by

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