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)[source]
Make a sankey diagram
- Parameters
left (
typing.List
[str
]) – Mapping sourceright (
typing.List
[str
]) – Mapping targettitle (
str
) – Diagram titleleft_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 plotfont_size (
float
) – Font size for the plotwidth (
int
) – Graph widthheight (
int
) – Graph heightshow (
bool
) – Whether to show interactive figure or only return the figure dictembed_js (
bool
) – Whether to embed plotly.js library (only relevant whenshow=True
)
- Return type
- Returns
fig – Figure dict that can be fed to
plotly.offline.iplot()
to show an interactive figure, or toplotly.io.write_image()
to produce a static image file.
Note
If a mapping function is specified for
link_color
, it should expect apd.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