Display Sankey diagrams in IPython / Jupyter notebook using d3-sankey-diagram.
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.
Tested in Firefox and Chrome. There have been reports that it's not working in Safari.
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)
See notebooks in examples folder for usage examples. You can try these online using
Binder, or follow the links to static versions on nbviewer:
linkLabelFormat
to a d3-format string; links whose value is more than linkLabelMinWidth
will have a label using that format.on_node_clicked
and
on_link_clicked
. These replace the on_selected
event.