networkx.drawing.layout.spiral_layout¶
- spiral_layout(G, scale=1, center=None, dim=2, resolution=0.35, equidistant=False)[source]¶
Position nodes in a spiral layout.
- Parameters
- GNetworkX graph or list of nodes
A position will be assigned to every node in G.
- scalenumber (default: 1)
Scale factor for positions.
- centerarray-like or None
Coordinate pair around which to center the layout.
- dimint
Dimension of layout, currently only dim=2 is supported. Other dimension values result in a ValueError.
- resolutionfloat
The compactness of the spiral layout returned. Lower values result in more compressed spiral layouts.
- equidistantbool
If True, nodes will be plotted equidistant from each other.
- Returns
- posdict
A dictionary of positions keyed by node
- Raises
- ValueError
If dim != 2
Notes
This algorithm currently only works in two dimensions.
Examples
>>> G = nx.path_graph(4) >>> pos = nx.spiral_layout(G)