npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@upsetjs/jupyter_widget

v1.6.0

Published

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

Downloads

33

Readme

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:

jupyter-lab 1.2.x:

pip install ipywidgets==7.5.1 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

jupyter-lab 2.1.x:

# 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/[email protected] @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
pipenv
pipenv shell
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/[email protected]
jupyter labextension install .

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.