Skip to main content
`Ctrl`+`K`

# planar_layout

planar_layout(G, scale=1, center=None, dim=2)

  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 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 dict

      A dictionary of positions keyed by node

  Raises:
    NetworkXException

      If G is not planar

  Examples

      >>> G = nx.path_graph(4)
      >>> pos = nx.planar_layout(G)