- scanpy.tl.draw_graph(adata, layout='fa', init_pos=None, root=None, random_state=0, n_jobs=None, adjacency=None, key_added_ext=None, neighbors_key=None, obsp=None, copy=False, **kwds)
An alternative to tSNE that often preserves the topology of the data better. This requires to run
Force-directed graph drawing describes a class of long-established algorithms for visualizing graphs. It has been suggested for visualizing single-cell data by [Islam11]. Many other layouts as implemented in igraph [Csardi06] are available. Similar approaches have been used by [Zunder15] or [Weinreb17].
- adata :
Annotated data matrix.
- layout :
Literal[‘fr’, ‘drl’, ‘kk’, ‘grid_fr’, ‘lgl’, ‘rt’, ‘rt_circular’, ‘fa’] (default:
ForceAtlas2) or any valid igraph layout. Of particular interest are ‘fr’ (Fruchterman Reingold), ‘grid_fr’ (Grid Fruchterman Reingold, faster than ‘fr’), ‘kk’ (Kamadi Kawai’, slower than ‘fr’), ‘lgl’ (Large Graph, very fast), ‘drl’ (Distributed Recursive Layout, pretty fast) and ‘rt’ (Reingold Tilford tree layout).
- root :
Root for tree layouts.
- random_state :
For layouts with random initialization like ‘fr’, change this to use different intial states for the optimization. If
None, no seed is set.
- adjacency :
Sparse adjacency matrix of the graph, defaults to neighbors connectivities.
- key_added_ext :
By default, append
Continue computation, starting off with ‘X_draw_graph_`layout`’.
- init_pos :
False, or any valid 2d-
.obsmkey. Use precomputed coordinates for initialization. If
None(the default), initialize randomly.
- neighbors_key :
If not specified, draw_graph looks .obsp[‘connectivities’] for connectivities (default storage place for pp.neighbors). If specified, draw_graph looks .obsp[.uns[neighbors_key][‘connectivities_key’]] for connectivities.
- obsp :
Use .obsp[obsp] as adjacency. You can’t specify both
neighbors_keyat the same time.
- copy :
Return a copy instead of writing to adata.
- adata :
copy, returns or updates
adatawith the following field.
Coordinates of graph layout. E.g. for layout=’fa’ (the default), the field is called ‘X_draw_graph_fa’