decoupler.plot_network

decoupler.plot_network(net, obs=None, act=None, n_sources=5, n_targets=10, by_abs=True, node_size=0.5, label_size=5, s_cmap='RdBu_r', t_cmap='viridis', vcenter=False, c_pos_w='darkred', c_neg_w='darkblue', s_label='Enrichment score', t_label='Gene expression', layout='kk', figsize=(10, 10), dpi=150, return_fig=False, save=None)

Plot results of enrichment analysis as network.

Parameters:
netDataFrame

Network dataframe with source and target columns (weight is optional).

obsNone, DataFrame

Input of enrichment analysis, needs to be a one row dataframe with targets as features. Used to filter net.

actNone, DataFrame

Ouput of enrichment analysis, needs to be a one row dataframe with sources as features. Used to filter net.

n_sourcesstr, list, int

Number of top sources to plot or list of source names.

n_targetsstr, list, int

Number of top targets to plot or list of target names.

by_absbool

Whether to consider the absolute value when sorting for n_sources and n_targets.

node_sizefloat

Size of the nodes in the plot.

label_sizeint

Size of the labels in the plot.

s_cmapstr

Color or colormap to use to color sources.

t_cmapstr

Color or colormap to use to color targets.

vcenterbool

Whether to center colors around 0.

c_pos_wstr

Color for edges with positive weights. If no weights are available, they are set to positive by default.

c_neg_wstr

Color for edges with negative weights.

s_labelstr

Label to place in the source colorbar.

t_labelstr

Label to place in the target colorbar.

layoutstr

Layout to use to order the nodes. Check igraph documentation for more options.

figsizetuple

Figure size.

dpiint

DPI resolution of figure.

return_figbool

Whether to return a Figure object or not.

savestr, None

Path to where to save the plot. Infer the filetype if ending on {.pdf, .png, .svg}.

Returns:
figFigure, None

If return_fig, returns Figure object.