mmcci.pl.network_plot
- mmcci.pl.network_plot(network, p_vals=None, diff_plot=False, normalise=True, remove_unconnected=True, show_labels=False, p_val_cutoff=0.05, edge_weight=50, text_size=15, node_size=2500, figsize=None, arrowsize=20, node_label_dist=1, p_val_text_size=10, node_colors=None, node_palette='tab20', outer_node_palette=None, show=True, show_legend=True, legend_size=12, title=None, title_size=14)[source]
Plots a network with optional edge significance highlighting and node coloring based on in-degree and out-degree difference.
- Parameters:
network (pandas.DataFrame or numpy.ndarray) – The adjacency matrix representing the network.
p_vals (pandas.DataFrame or numpy.ndarray, optional) – A matrix of p-values corresponding to the edges in network. If not provided, significance values will not be plotted. Defaults to None.
diff_plot (bool, optional) – Whether you are plotting the network difference, to show up and down-regulated edges. Defaults to False.
normalise (bool, optional) – Whether to normalize the network matrix before plotting. Defaults to True.
remove_unconnected (bool, optional) – Whether to remove cell types that do not interact with any cell types. Defaults to True.
show_labels (bool, optional) – Whether to show node labels. Defaults to True.
p_val_cutoff (float, optional) – The p-value cutoff for determining significant edges. Defaults to 0.05.
edge_weight (float, optional) – The base weight for edges. Defaults to 20.
text_size (int, optional) – The font size for node labels. Defaults to 15.
node_size (int, optional) – The size of the nodes. Defaults to 2500.
figsize (tuple, optional) – The size of the figure. Defaults to None.
arrowsize (int, optional) – The size of the arrow heads for edges. Defaults to 50.
node_label_dist (float, optional) – A factor for adjusting the distance between nodes and labels. Defaults to 1.
p_val_text_size (int, optional) – The font size for p-value labels. Defaults to 10.
node_colors (dict, optional) – A dictionary of colors for each node. Overwrites node_palette. Defaults to None.
node_palette (str, optional) – The name of the color palette to use for nodes. Defaults to “tab20”.
outer_node_palette (str, optional) – The name of the color palette to use for outer nodes to show sender/reciever nodes. Defaults to None.
show (bool, optional) – Whether to show the plot or not. Defaults to True.
show_legend (bool, optional) – Whether to show legend. Defaults to False.
legend_size (int, optional) – Font size for legend. Defaults to 12.
title (str, optional) – Title of the plot. Defaults to None.
title_size (int, optional) – Font size for title. Defaults to 14.
- Returns:
A tuple containing the figure and axis objects.
- Return type:
tuple