networkx.drawing.layout.planar_layout¶
-
planar_layout
(G, scale=1, center=None, dim=2)[source]¶ Position nodes without edge intersections.
Parameters: G (NetworkX graph or list of nodes) – A position will be assigned to every node in G. If G is of type PlanarEmbedding, the positions are selected accordingly.
Parameters: - G (NetworkX graph or list of nodes) – A position will be assigned to every node in G. If G is of type nx.PlanarEmbedding, the positions are selected accordingly.
- scale (number (default: 1)) – Scale factor for positions.
- center (array-like or None) – Coordinate pair around which to center the layout.
- dim (int) – Dimension of layout.
Returns: pos – A dictionary of positions keyed by node
Return type: Raises: nx.NetworkXException
– If G is not planarExamples
>>> G = nx.path_graph(4) >>> pos = nx.planar_layout(G)