A Jupyter Widget Library around UpSet.js.
This package is part of the UpSet.js ecosystem located at the main Github Monorepo.
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
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
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
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
the package documentation is located at . An introduction Jupyter Notebooks is at .
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
see also venn.ipynb
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
see also kmap.ipynb
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 .
yarn test
yarn lint
yarn build !! within the pipenv
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.
If you want to use Upset.js for a commercial application the commercial license is the appropriate license. Contact @sgratzl for details.
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.