Skip to content

blessyjoyk/ipysankeywidget

 
 

Repository files navigation

IPython Sankey diagram widget Binder

Display Sankey diagrams in IPython / Jupyter notebook using d3-sankey-diagram.

Installation

Prerequesites: You need to have installed and enabled ipywidgets. If installing with pip, make sure to have enabled it by running jupyter nbextension enable --py --sys-prefix widgetsnbextension. Installing using conda does this automatically.

To install using pip:

$ pip install ipysankeywidget
$ jupyter nbextension enable --py --sys-prefix ipysankeywidget

To install using conda:

$ conda install -c big_cake ipysankeywidget

For a development installation (requires npm),

$ git clone https://github.com/ricklupton/ipysankeywidget.git
$ cd ipysankeywidget
$ pip install -e .
$ jupyter nbextension install --py --symlink --user ipysankeywidget
$ jupyter nbextension enable --py --user ipysankeywidget

Browser support

Tested in Firefox and Chrome. There have been reports that it's not working in Safari.

Documentation

See the d3-sankey-diagram API docs: the value of the SankeyWidget is exactly the same as the sankey object described there.

Examples

See notebooks in examples folder for usage examples. You can try these online using Binder, or follow the links to static versions on nbviewer:

Changelog

v0.2.4

  • Ipysankeywidget can now be installed using conda
  • Add events for clicking on nodes and links: on_node_clicked and on_link_clicked. These replace the on_selected event.
  • Change figure size using Layout object:
layout = Layout(width="1000", height="1200")
SankeyWidget(links=data,layout=layout)

Contributors

  • Ali Alsabbah

About

IPython / Jupyter Sankey diagram widget

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 54.8%
  • JavaScript 44.6%
  • Shell 0.6%