Skip to main content

Display Sankey diagrams in Jupyter

Project description

IPython Sankey diagram widget Binder Conda Version

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

Installation

To install use pip:

$ pip install ipysankeywidget

Alternatively, to install using conda:

$ conda install -c conda-forge ipysankeywidget

For a development install, see DEVELOPING.md.

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 attributes of the SankeyWidget are the same as the properties of the sankey object described there.

To change the figure size, use the ipywidgets Layout object:

layout = Layout(width="1000", height="1200")
SankeyWidget(links=data, layout=layout)

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.5.0 (16 December 2022)

  • Compatible with Jupyter Lab as well as Jupyter notebook.

v0.4.2 (29 April 2022)

  • Expose d3-sankey-diagram nodePositions() option to allow for custom node layout.

v0.4.1 (18 February 2021)

  • Experimental support for link "markers"
  • Experimental support for showing HTML info for links

v0.4.0 (19 November 2020)

  • Update to d3-sankey-diagram v0.8.0

v0.3.0

  • Now supports Jupyterlab

v0.2.5

  • You can now show link values as SVG text elements. Set linkLabelFormat to a d3-format string; links whose value is more than linkLabelMinWidth will have a label using that format.
  • Upgrade to d3-sankey-diagram version 0.7.3
  • ipysankeywidget can now be installed using conda (thanks to Ali Alsabbah #33)
  • Add a check for duplicate links (thanks to Remi Bois #23)

v0.2.4

  • Add events for clicking on nodes and links: on_node_clicked and on_link_clicked. These replace the on_selected event.

Contributors

  • Rick Lupton
  • Nicholas Bollweg
  • Ali Alsabbah
  • Remi Bois
  • Miguel Mendez

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

ipysankeywidget-0.5.0.tar.gz (475.1 kB view hashes)

Uploaded Source

Built Distribution

ipysankeywidget-0.5.0-py3-none-any.whl (330.1 kB view hashes)

Uploaded Python 3

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