scglue.plot.sankey

scglue.plot.sankey(left, right, title='Sankey', left_color='#E64B35', right_color='#4EBBD5', link_color='#CCCCCC', font_family='Arial', font_size=15.0, width=400, height=400, show=True, embed_js=False)[源代码]

Make a sankey diagram

参数:
  • left (typing.List[str]) – Mapping source

  • right (typing.List[str]) – Mapping target

  • title (str) – Diagram title

  • left_color (typing.Union[str, typing.Callable[[str], str]]) – Color of left nodes, either a single color or a mapping function that returns a color given the node name.

  • right_color (typing.Union[str, typing.Callable[[str], str]]) – Color of right nodes, either a single color or a mapping function that returns a color given the node name.

  • link_color (typing.Union[str, typing.Callable[[pandas.core.series.Series], str]]) – Color of links, either a single color or a mapping function that returns a color given the link info.

  • font_family (str) – Font family used for the plot

  • font_size (float) – Font size for the plot

  • width (int) – Graph width

  • height (int) – Graph height

  • show (bool) – Whether to show interactive figure or only return the figure dict

  • embed_js (bool) – Whether to embed plotly.js library (only relevant when show=True)

返回类型:

dict

返回:

fig – Figure dict that can be fed to plotly.offline.iplot() to show an interactive figure, or to plotly.io.write_image() to produce a static image file.

备注

If a mapping function is specified for link_color, it should expect a pd.Series object as the only argument, which contains the following fields:

  • left: the left node

  • right: the right node

  • value: population size connecting the two nodes