scirpy.util.graph.layout_components

scirpy.util.graph.layout_components(graph, component_layout='fr', arrange_boxes='squarify', pad_x=1.0, pad_y=1.0)

Compute a graph layout by layouting all connected components individually.

Adapted from https://stackoverflow.com/questions/53120739/lots-of-edges-on-a-graph-plot-in-python

Parameters
graph : GraphGraph

The graph to plot.

component_layout : strstr (default: 'fr')

Layout function used to layout individual components. Can be anything that can be passed to igraph.Graph.layout

arrange_boxes : {‘size’, ‘rpack’, ‘squarify’}Literal[‘size’, ‘rpack’, ‘squarify’] (default: 'squarify')

How to arrange the individual components. Can be “size” to arange them by the component size, or “rpack” to pack them as densly as possible, or “squarify” to arrange them using a treemap algorithm.

pad_x : floatfloat (default: 1.0)

Padding between subgraphs in the x dimension.

pad_y : floatfloat (default: 1.0)

Padding between subgraphs in the y dimension.

Return type

ndarrayndarray

Returns

pos n_nodes x dim array containing the layout coordinates