phlower.ext.plot_stream_sc

phlower.ext.plot_stream_sc(adata, root='root', color=None, dist_scale=1, dist_pctl=95, preference=None, fig_size=(7, 4.5), fig_legend_ncol=1, fig_legend_order=None, vmin=None, vmax=None, alpha=0.8, pad=1.08, w_pad=None, h_pad=None, show_text=True, show_graph=True, show_legend=True, titles=None, text_attr='original', save_fig=False, fig_path=None, fig_format='pdf', return_fig=False, s=30, order=True, plotly=False, cmap_continous='viridis')

Generate stream plot at single cell level (aka, subway map plots)

Parameters

adata: AnnData

Annotated data matrix.

root: str, optional (default: ‘root’):

The starting node, temporialy abandoned cause it can be decided automatically.

color: list optional (default: None)

Column names of observations (adata.obs.columns) or variable names(adata.var_names). A list of names to be plotted.

dist_scale: float,optional (default: 1)

Scaling factor to scale the distance from cells to tree branches (by default, it keeps the same distance as in original manifold)

dist_pctl: int, optional (default: 95)

Percentile of cells’ distances from branches (between 0 and 100) used for calculating the distances between branches.

preference: list, optional (default: None):

The preference of nodes. The branch with speficied nodes are preferred and put on the top part of stream plot. The higher ranks the node have, the closer to the top the branch with that node is.

fig_size: tuple, optional (default: (7,4.5))

figure size.

fig_legend_order: dict,optional (default: None)

Specified order for the appearance of the annotation keys.Only valid for ategorical variable e.g. fig_legend_order = {‘ann1’:[‘a’,’b’,’c’],’ann2’:[‘aa’,’bb’,’cc’]}

fig_legend_ncol: int, optional (default: 1)

The number of columns that the legend has.

vmin,vmax: float, optional (default: None)

The min and max values are used to normalize continuous values. If None, the respective min and max of continuous values is used.

alpha: float, optional (default: 0.8)

0.0 transparent through 1.0 opaque

pad: float, optional (default: 1.08)

Padding between the figure edge and the edges of subplots, as a fraction of the font size.

h_pad, w_pad: float, optional (default: None)

Padding (height/width) between edges of adjacent subplots, as a fraction of the font size. Defaults to pad.

show_text: bool, optional (default: False)

If True, node state label will be shown

show_graph: bool, optional (default: False)

If True, the learnt principal graph will be shown

save_fig: bool, optional (default: False)

if True,save the figure.

fig_path: str, optional (default: None)

if save_fig is True, specify figure path. if None, adata.uns[‘workdir’] will be used.

fig_format: str, optional (default: ‘pdf’)

if save_fig is True, specify figure format.

plotly: bool, optional (default: False)

if True, plotly will be used to make interactive plots

cmap_continous: str, optional (default: ‘viridis’)

continuous values cmap

Returns

updates adata with the following fields. X_stream_root: numpy.ndarray (adata.obsm[‘X_stream_root’])

Store #observations × 2 coordinates of cells in subwaymap plot.

stream_root: dict (adata.uns[‘stream_root’])

Store the coordinates of nodes (‘nodes’) and edges (‘edges’) in subwaymap plot.