stream2.pl.stream_sc
- stream2.pl.stream_sc(adata, source=0, key='epg', color=None, dict_palette=None, dist_scale=1, dist_pctl=95, size=8, drawing_order='sorted', dict_drawing_order=None, preference=None, fig_size=(7, 4.5), fig_ncol=1, fig_legend_ncol=1, fig_legend_order=None, vmin=None, vmax=None, alpha=0.8, pad=1.08, w_pad=None, h_pad=None, cbar_pad=0.04, cbar_fraction=0.05, cbar_aspect=40, show_text=True, show_graph=True, save_fig=False, fig_path=None, fig_name='plot_stream_sc.png', **kwargs)[source]
Generate stream plot at single cell level (aka, subway map plots)
- Parameters:
adata (AnnData) – Annotated data matrix.
root (str, optional (default: ‘S0’):) – The starting node
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 prioritized and put on the top part of stream plot. The higher ranks the node have, the closer to the top the branch with the 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 (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.
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 (float, optional (default: None)) – Padding (height/width) between edges of adjacent subplots, as a fraction of the font size. Defaults to 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
- Returns:
updates adata with the following fields.
stream_tree (dict (adata.uns[‘stream_tree’])) – Store details of the tree structure used in stream plots.